DIV相对于父DIV底部对齐的实现方法

我们在网站建设过程中经常会使用到底部对齐这样的技术,如果是表格来制作的话就简单了,但在CSS+DIV流行的今天,我们需要解决这样的问题就显得有点复杂,下面给出一段例子,希望对大家有所帮助。

先介绍一段没有底部对齐的代码:

以下是代码片段:
<style type="text/css">
.box1 {border:1px #cccccc solid;  width:500px; height:600px;}
.box2 {border-top:1px #cccccc solid; border-bottom:0; background:#f2f6fb; width:500px; height:22px;}
</style>
<div class="box1">
    <div class="box2"></div>
</div>

posted @ 2010-06-28 10:37  zxlin25  阅读(463)  评论(0编辑  收藏  举报