在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