在我的CSS布局中混合液体和固定元素似乎令人不安。我尝试了各种设置,但我无法正确理解它。固定和液柱的CSS布局
我正在尝试创建一个模板,其中主要内容由每侧(顶部,左侧,右侧,底部)上的内容包围。
<div id="container">
<div id="header">k</div>
<div id="left-column"></div>
<div id="center-column"><h1>Main Page</h1> Liquid layout trial</div>
<div id="right-column"></div>
<div id="footer"></div>
</div>
顶部酒吧(头)应该有固定的高度。 左栏应该有固定的高度/宽度 中栏应根据视口和内容浮动在高度/宽度 右栏应该有固定的高度/宽度。 页脚应该有固定的高度
这里是我的CSS:
#header{
background-color: blue;
height 50px;
color: white;
clear:both;
}
#left-column{
background-color: green;
width:100px;
height:400px;
float: left;
}
#center-column{
background-color: yellow;
float:left;
}
#right-column{
background-color: red;
float:right;
height: 400px;
width: 100px;
}
#footer{
clear: both;
height: 50px;
background-color: pink;
}
中心柱似乎并不使用它的整个宽度/高度,我希望这四个“面”之间是整个区域黄色。
另一个问题是限制视,右列下降到中心柱下方
我也弄不明白,为什么我的头必须要显示的内容。如果我删除了字符“K”,它不可见。
我来到这里发现,此示例的小提琴:http://jsfiddle.net/jasonBr81/vZDND/2/
Btw。您示例中的标题非常小,因为您在高度属性上忘了':'。 – insertusernamehere 2012-07-05 18:54:27
谢谢!我现在在提琴手中解决了这个问题。 – Kman 2012-07-05 19:33:10