请看截图。我正在尝试生成一个布局,允许我使用 div 左侧(headerLeft)和右侧(headerRight)将阴影应用到主 div 的任一侧,然后我拥有包含标题内容的内容 div(header)。这一切都包装在一个 div(headerWrapper)中。我正在使用 4 个 div 来执行此操作。我让它在我的标题、导航栏和我正在使用的另一个栏上工作。这在屏幕截图上以颜色编码的 div 显示。之所以可行,是因为我的 CSS 使用以像素为单位的高度。但是我有问题。我想将此应用于我的主要内容,但它不起作用。内容的高度会随着页面的变化而变化,这很好,但是我的包含阴影的 div 不会出现,除非我给它们一个固定的像素高度。请帮忙。
布局问题 http://www.webquark.co.uk/layoutProblem.jpg
这是我为工作布局所拥有的 CSS:
#header{
margin:0 auto;
height:160px;
width: 76%;
min-width:850px;
font-size: 14pt;
font-family: Calibri, Verdana, Ariel, sans-serif;
color: #ffffff;
background-image: url(headerBG.jpg);
background-repeat: repeat-x;
}
#headerWrapper{
height:145px;
width:100%;
/**background-color: #202020;**/
}
#headerLeft
{
float: left;
width: 12%;
height:145px;
background-image: url(shadowLeft.png);
background-repeat: repeat-y;
background-position: center right;
/**background-color: #1e1e1e;**/
}
#headerRight
{
float: right;
width: 12%;
height:145px;
background-image: url(shadowRight.png);
background-repeat: repeat-y;
background-position: center left;
/**background-color: #1e1e1e;**/
}
基本上我认为我需要将左右 div 的高度设置为 100%,我尝试将高度设置为 100%,但它不起作用。我的身高也设置为 100%
加油,希望能帮到你。
工作顶栏和标题的 HTML:
<div id="topWrapper">
<div id="topRight">
</div>
<div id="topLeft">
</div>
<div id="top">
</div>
</div>
<div id="headerWrapper">
<div id="headerRight">
</div>
<div id="headerLeft">
</div>
<div id="header">
</div>
</div>