我需要一些认真的CSS帮助来处理当前的项目。我附上了我希望我的页面看起来像的屏幕截图。我遇到的问题是正确定位div,以及使页面的宽度/高度保持100%。我想在不使用Javascript的情况下做到这一点。这是我的HTML:正确对齐Div
<body>
<div class="wrapper">
<div class="container_24">
<div class="grid_16">
<input type="text" value="Username" /><input type="text" value="Password" /><input type="button" value="Submit" /><span class="mainLink">Register</span>
</div>
</div>
<div class="container_16">
<form id="form1" runat="server">
<asp:ContentPlaceHolder ID="Body" runat="server">
</asp:ContentPlaceHolder>
</form>
</div>
<div class="container_24"></div>
</div>
</body>
这是我的CSS:
.wrapper{
min-height: 100%;
min-width: 100%;
/* Set up proportionate scaling */
width: 100%;
height: auto;
/* Set up positioning */
position: fixed;
top: 0;
left: 0;
}
.container_16 {
margin-left: auto;
margin-right: auto;
width: 960px;
min-height: 100%;
/* Set up proportionate scaling */
height: auto;
margin-top:0px;
padding-top:0px;
background-image:url(../images/Content_bkg.gif);
box-shadow: 0px 0px 15px rgb(0,0,0);
-webkit-box-shadow: 0px 0px 15px rgb(0,0,0);
}
.container_24 {
background-image: url(../images/headerFooter_bkg.gif);
height: 60px;
margin: 0px;
padding: 0px;
border: 1px solid rgb(71, 89, 32);
box-shadow: 0px 0px 15px rgb(0,0,0);
-webkit-box-shadow: 0px 0px 15px rgb(0,0,0);
position:relative;
width:100%;
}
形象有什么我希望它看起来像(横跨整个浏览器窗口):
实际:
我不知道的显示全高,除非你想一个好办法底部绿色的酒吧永远在那里。当你获得一些内容时,底部的绿色条应该向下移动。 – Leeish 2013-03-01 23:19:50
.content-16 - 它是否有任何内容?将其设置为高度:100%不能保证延伸。另外,你是否设置你的HTML和身体宽度:100%;高度:100%;? – 2013-03-01 23:19:51
如果你想让你的内容-16能够变大,我会设置'min-height'而不是'height'。如果它是父元素,它将是100%的高度。 – Leeish 2013-03-01 23:21:11