我有一个关于如何设置我的基本流体布局的快速问题。我在顶部有一个 40 像素高、100% 宽的标题栏,这看起来很棒。
然后我有一个#left 和#right div,每个分别浮动。这看起来很酷。它们都有 100% 的高度,效果很好,但问题是页面然后向下滚动 40px,因为标题栏有 40px ......如果我对标题使用流体布局,然后是内容框,它会看起来很糟糕在很小或很大的分辨率上。
有任何想法吗?
这是我的 CSS
body
{
background: #ebebeb;
margin: 0;
padding: 0;
min-width: 750px;
max-width: 1500px;
}
#wrap
{
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
#header
{
background: #414141;
height: 40px;
width: 100%;
}
#sidebar
{
width: 30%;
background: #ebebeb;
height: 100%;
float: left;
}
#rightcontent
{
width: 70%;
background: #fff;
height: 100%;
float: right;
}
#footer
{
width: 100%;
background: #414141;
height: 40px;
clear: both;
}
这是我的html页面:
<body>
<div id="wrap">
<div id="header">
head
</div>
<div id="sidebar">
side
</div>
<div id="rightcontent">
right
</div>
<div id="footer">
footer
</div>
</div>
</body>
这有帮助吗:)