三列自適應等高且中列寬度自適應的CSS布局實例,作者silence應用了很多HACK進行代碼編寫。
IE6是主要出現問題的浏覽器,希望在以後的發展中,IE6與標准不再協調的事情不要再次發生。我們看代碼:
<!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=utf-8" />
<title>三列自適應等高且中列寬度自適應 - www.mb5u.com</title>
<style type="text/CSS">
a{ color:#30C;}
.wrap{overflow:hidden;}
.left{width:250px;float:left; background:#FC9;}
.right{width:250px;float:right;background:#FC9;}
.center{ background:#FC0;_float:left;/* IE6 hack*/ overflow:hidden;}
.row{margin-bottom:-10000px;padding-bottom:10000px;}
</style>
</head>
<body>
<div class="wrap">
<div class="left row"><a href="#">www.mb5u.com</a></div>
<div class="right row">
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
</div>
<div class="center row">
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<a href="http://www.mb5u.com/">www.mb5u.com</a><br />
<span style="float:right; position:relative;"> </span> <!--for IE6-->
</div>
</div>
</body>
</Html>