如何保持左右两个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>
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>
相关文章推荐
- js实现两个div保持相同高度
- div如何实现左右两个panel并排,而且高度一致
- div如何实现左右两个panel并排,而且高度一致
- How to make two <div>…</div> in the same row?
- How to Backup Different Release Databases with the Same Catalog Database
- GridView Item 大小可能不一样,如何保持同一行的Item 高度大小相同,且GridView高度自适应!
- 如何利用QT在terminal终端执行ROS系统中的roslaunch命令(How to launch a roslaunch in Qt with a terminal (GUI) )
- How to align content of a div to the bottom with css?
- div保持相同高度
- How to fill the background with image in landscape in IOS? 如何使image水平铺满屏幕
- [转]How to insert a row between two rows in an existing excel with HSSF (Apache POI)
- 左右两个div高度自动一致,自适应高度
- 由于设计页面需要,要把两个并排显示的 div 实现一样高的效果, n 行 n 列布局,每列高度(事先并不能确定哪列的高度)相同,每个设计师追求的目标。方法有以下几种: 1 JS 实现(判断 2 个 d
- 如何在MMIT上使用WMLScript文件(How To Use WMLScript Files With MMIT)
- How to connect DB2 with ruby on rails 如何连接DB2数据库
- GridView Item 大小可能不一样,如何保持同一行的Item 高度大小相同,且GridView高度自适应!
- GridView Item 大小可能不一样,如何保持同一行的Item 高度大小相同,且GridView高度自适应!
- 基于jQuery实现左右div自适应高度完全相同实现代码
- 左右div高度相同
- 左右两个div高度自适应