I want to convert my web page into four section, one horizontal and three vertical. The horizontal section is okay, but there are two issues with vertical sections:
- They are not filling the complete screen height.
- The third section is overlapping with second section by nearly 10 or 20 pixels.
Here is my CSS:
body{
width: available;
height: available;
}
.container{
width: available;
height: available;
}
.leftpane{
width: 25%;
min-width: 350px;
height: available;
min-height: 400px;
float: left;
background-color: rosybrown;
border-collapse: collapse;
}
.middlepane{
width: 50%;
min-width: 800px;
height: available;
min-height: 650px;
float: left;
background-color: royalblue;
border-collapse: collapse;
}
.rightpane{
width: available;
height: available;
position: relative;
margin-left: 75%;
background-color: yellow;
border-collapse: collapse;
}
.toppane{
width: available;
height: 100px;
border-collapse: collapse;
background-color: #4da6ff;
}
And this is the HTML page:
<div class="container">
<div class="toppane">Test Page</div>
<div class="leftpane"><h1>Test Page</h1></div>
<div class="middlepane">Test Page</div>
<div class="rightpane"><h1>Test Page</h1></div>
</div>
My output is this:
And I want it to be like this:
Here is a jsfiddle .
4条答案
按热度按时间nvbavucw1#
width: available
不是有效属性。如果要使用所有可用空间,则应设置width: 100%
。无论如何,为解决问题,您还应将height: 100%
用于body
和html
。请参阅以下示例:*第一个
备注:
**1.**我删除了所有的
min-width
和min-height
,在这种情况下,您不需要这些。**2.**将
height: 100%
用于您的元素,您还应该在body
和html
标签上设置此选项。**3.**左侧窗格应为
float: left
,右侧窗格应为float: right
,中间窗格应为float: left
或float: right
,右侧窗格应为width: 50%
2022更新!
以下是通过Flex更新的版本:
第一次
qyswt5oh2#
检查here,您将获得将屏幕划分为三列的最简单代码。
HTML档案
CSS档案
l3zydbqr3#
使用具有网格系统的Twitter Bootstrap框架。
EXAMPLE
iqjalb3h4#