它適用於Firefox,Safari和Chrome,但不適用於IE。我試着給出width
,然後margin-left:auto;
和margin-right:auto;
請幫忙。如何在IE中使用漸變包裝背景將內容DIV居中?
這裏的鏈接 http://www.ellenselbiedesign.com/public/testing/index.html
這裏是我的CSS
* {
padding: 0px;
margin: 0px;
}
.wrapper { min-height: 100%; height: auto !important; height: 100%; margin: 0 auto -250px;
background: #aad3d9; /* old browsers */
background: -moz-linear-gradient(top, #80BCC5 0%, #ffffff 100%); /* firefox */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#80BCC5), color-stop(100%,#ffffff)); /* webkit */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80BCC5', endColorstr='#ffffff',GradientType=0); /* ie */ } /* corresponds to height of #footer */
#body-wrapper {
height: 100%;
width: 100%;
}
#header {
width: 960px;
margin-left:auto;
margin-right:auto;
}
#header img {
padding-top: 15px;
}
#header p{
color: #784f78;
font-size: 15px;
font-family: Arial, Arial, Helvetica, sans-serif;
font-weight:bold;
text-align:right;
margin-top: -33px;
line-height:90%
}
也從不寫寬度:100%的div。它沒有好處(即你添加填充和它打破)。它自動填充可用空間 – mreq