css之等高布局

2016-10-26  本文已影响41人  Q_Mia

1. 在父元素中不设置高度,使用overflow:hidden;

2. 使用很大的正padding-bottom,和相等的负的margin-bottom来实现

参考链接:http://www.51xuediannao.com/html+css/htmlcssjq/683.html

<div class="parent">

    <div class="left"></div>

   <div class="right"></div>

</div>

css:

.parent{

width:1000px;

overflow:hidden;

}

.left{

width:45%

float:left

padding-bottom:2000px;

margin-bottom:-2000px;

}

.right{

width:55%

float:right

padding-bottom:2000px;

margin-bottom:-2000px;

}

上一篇 下一篇

猜你喜欢

热点阅读