css 左右DIV等高

文章参考  

http://blog.csdn.net/wodetiankong516/article/details/12010121

http://dreamweaver.abang.com/od/divcss/a/div-denggao0.htm

 

<style>
	.wrap{
		overflow: hidden;
	}

    .left{
        width: 200px;
        margin-bottom:-10000px;
        padding-bottom: 10000px;
        background: red;
        float: left;
    }

    .right{
        width: 200px;
        margin-bottom: -10000px;
        padding-bottom:10000px;
        background: blue;
        float: left;
    }
</style>
<body >
    <div class="wrap">
    
        <div class="left">
            left<br>
            left<br>
        </div>
        <div class="right">
            right<br>
            right<br>
            right<br>
            right<br>
            right<br>
            right<br>
            right<br>
        </div>
    </div>
</body>

 

对以上代码的部分解释:  

1、最外面的wrap必须使用overflow:hidden来隐藏溢出的内容。  

2、left和right两个div底部外补丁为-10000px,底部内补丁为10000px,这是必须设置的,如果内容可能会较多,可以将数值再增大。

 

 

你可能感兴趣的:(css)