三列自适应等高且中列宽度自适

本文介绍了一个三列自适应等高的CSS布局实例,该布局能够使左右两列固定宽度,中间列自适应宽度,并确保三列高度相同。通过使用特定的CSS技巧和针对IE6的HACK,实现了良好的跨浏览器兼容性。

三列自适应等高且中列宽度自适应的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>

 

转载于:https://www.cnblogs.com/tianma3798/p/4023949.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值