您的位置:首页 > 其它

如何保持左右两个DIV高度相同( how to keep two div with same height)

2008-05-28 16:49 567 查看
客户的提问:

Unfortunately I haven found out an answer to this. Anybody have an idea ?

I have two DIVs on my master page. Left "frame" and the content. Of course I do have background color on the left frame so my problem is, how to make the DIV height from top to bottom on the left frame ? I can use "height: 100%", but that gives only windows size. So e.g. when content part is higher than screen then the Left Frame ends when you scroll down even you are not at end of the page. I'll try to describe it by this:

回答:

use javascript on your body's onload event:

it works on my machine

enjoy the code:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >

<head>

</style>

</script>

</head>

<body onload="full();">

<div id="left">

<p class="top">Left DIV</p>

</div>

<div id="right" class="content">

<p> Content DIV </p>

<br />

<br />

Add enough < BR / > tags to get this DIV enough higher than your screen.

<br />

<br />

<br /><br />

<br />

<br /><br />

<br />

<br /><br />

<br />

<br /><br />

<br />

<br /><br />

<br />

<br /><br />

<br />

<br /><br />

<br />

<br /><br />

<br />

<br /><br />

<br />

<br /><br />

<br />

<br /><br />

<br />

<br /><br />

<br />

<br /><br />

<br />

<br /><br />

<br />

<br /><br />

<br />

<br /><br />

<br />

<br /><br />

<br />

<br /><br />

<br />

<br /><br />

<br />

<br /><br />

<br />

<br /><br />

<br />

<br /><br />

<br />

<br />

test

</div>

</body>

</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐