在html/css
One approach involves setting large bottom padding, negating that padding with negative bottom margin, and surrounding the divs with a container with hidden overflow.
ImplementationTo demonstrate this technique, consider the following CSS code:
#container { 溢出:隐藏; 宽度:100%; } #左col { 浮子:左; 宽度:50%; 背景色:橙色; 填充底:500EM; 保证底:-500EM; } #Right-Col { 浮子:左; 宽度:50%; 边缘右:-1px; / *对于IE兼容性 */ 边界左:1px固体黑色; 背景色:红色; 填充底:500EM; 保证底:-500EM; }
In the HTML, create the div container and two child divs:
This approach essentially forces the two divs to have the same height, even if they contain different amounts of content.较大的底部填充和负距离相互抵消,使DIV仅占用所需的垂直空间。具有隐藏溢出的容器可确保任何多余的内容都不可见。
很少,这提供了一种CSS的高度浮动的,免责声明: 提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发到邮箱:[email protected] 我们会第一时间内为您处理。
Copyright© 2022 湘ICP备2022001581号-3