且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

设置高度< div> =到另一个的高度< div>通过.css

更新时间:2022-05-31 06:09:00

我假设你已经使用了height属性,所以我把它与一个高度比较
left with javasript

I am assuming that you have used height attribute at both so i am comparing it with a height left do it with javasript

var right=document.getElementById('rightdiv').style.height;
var left=document.getElementById('leftdiv').style.height;
if(left>right)
{
    document.getElementById('rightdiv').style.height=left;
}
else
{
    document.getElementById('leftdiv').style.height=right;
}

另一种想法可以在这里找到
HTML / CSS:使两个浮动div具有相同的高度

Another idea can be found here HTML/CSS: Making two floating divs the same height

请注意,此代码未经测试

note that this code is not tested

感谢我希望这将帮助您......关注... :)

Thanks i hope that this would help you ......regards...:)