CSS三列高度自适应布局

HTML Output

<div id="block_1">
	...
</div>
<div id="block_2">
	...
</div>
<div id="block_3">
	...
</div>

CSS Rules

#block_1
	{
	float: left;
	width: 34%;
	margin-left: 33%;
	}
* html #block_1
	{
	display: inline;
	}
#block_2
	{
	float: left;
	width: 33%;
	margin-left: -67%;
	}
#block_3
	{
	float: left;
	width: 33%;
	}
#footer
	{
	clear: both;
	}
* html body
	{
	margin: 0;
	padding: 0;
	}
* html #footer
	{
	position: relative;
	}

 

 

带wrapper:

HTML Output

<div id="wrapper">
<div id="block_1">
	...
</div>
<div id="block_2">
	...
</div>
<div id="block_3">
	...
</div>
</div>

CSS Rules

body
	{
	direction: rtl;
	}
#block_1
	{
	float: right;
	width: 34%;
	margin-right: 33%;
	}
* html #block_1
	{
	display: inline;
	}
#block_2
	{
	float: right;
	width: 33%;
	margin-right: -67%;
	}
#block_3
	{
	float: right;
	width: 33%;
	}
/* we need this for IE 5.01 - otherwise the wrapper does not expand to the
necessary height (unless fixed, this problem becomes even more acute 
weirdness as the method is enhanced */
#wrapper
	{
/* Normally a Holly-style hack height: 1% would suffice but that causes 
IE 5.01 to completely collapse the wrapper - instead we float it */
	float: left;
/* NB. possibly only IE 5.01 needs to get this float value - otherwise 5.5 sometimes 
(I saw it happen many moons ago) makes the width of wrapper too small 
the float: none with the comment is ignored by 5.01,
5.5 and above see it and carry on about their business
It's probably fine to just remove it, but it's left here 
just in case that many moons ago problem rears its head again */
	float/**/: none;
	}
/* easy clearing */
#wrapper:after
	{
	content: '[DO NOT LEAVE IT IS NOT REAL]'; 
	display: block; 
	height: 0; 
	clear: both; 
	visibility: hidden;
	}
#wrapper
	{
	display: inline-block;
	}
/*\*/
#wrapper
	{
	display: block;
	}
/* end easy clearing */
#footer
	{
	clear: both;
	}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值