div+css 左右两列高度自适应以及父级div也跟着自适应子级的高度

div+css 左右两列高度自适应以及父级div也跟着自适应子级的高度

代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>左右两列高度自适应以及父级div也跟着自适应子级的高度</title>
<style type="text/css">
      #container { width:216px; height:auto;overflow: hidden; }
      #container div { float: left; width:8px; margin-bottom: -800px; padding-bottom: 800px; }
   #container .zuo{ background-image:url(http://www.616sc.com/616/f_lm.gif)}
   #container .you{ background-image:url(http://www.616sc.com/616/f_rm.gif)}
      #container .col2 {width:200px;border-bottom:#999999 1px solid}
    .clear{clear: both;}
</style>
</head>

<body>

<div id="container">
    <div class="zuo"></div>
    <div class="col2">

    </div>
    <div class="you"></div>
</div>

</body>

</html>

你可能感兴趣的:(div+css)