2012-06-21 54 views
0

在firefox中看起來很好,但圖像沒有顯示在中心。爲什麼我的主圖像不在Chrome的中心?

在Chrome瀏覽圖片如果您刷新瀏覽器得到它對準中心&然後回到左幾秒鐘後,沒有在瀏覽器窗口中

的中心對齊。

謝謝你的幫助。 這裏是Demo Template. Thx。

CSS代碼:

html,body { 
     margin: 0; 
     padding: 0; 
     text-align: center; 
     font-family: arial, Helvetica, sans-serif; 
     font-size: 14px; 
     /*background: #FFF url("images/border.jpg") repeat-y center;*/ 
} 
#wrapper{ 
    margin:0 30px; 
    width: 95%; 
    box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.4); 
    } 

#anti-shadow-div{ 
    display:table; 
    overflow:hidden; 
} 

img { border: none; } 
a { text-decoration: none; color: #2965a6; font-weight: bold;} 
a:hover { text-decoration: underline; color: #fca00e; } 

/*---------- Divs ----------*/ 

/*#header { 
     background: url("images/logo006.jpg") no-repeat center; 
     height: 120px; 
     width: 100%; 
     margin: 0 auto; 
}*/ 





#header001 { 
     background: url("images/logo001.jpg") no-repeat center top;width:890px;height:133px; 
     height: 133px; 
     width: 900px; 
     margin: 0 auto; 
     font-family: arial, Helvetica, sans-serif; 
     font-size: 50px; 
} 


#indexheader{ 
background:#FFFFFF; 
height: 30px; 
     width: 890px; 
     margin: 0 auto; 
     font-family: arial, Helvetica, sans-serif; 
     font-size: 50px; 
     } 
#indeximg{ 
float:left; 
} 

#navibtn{ 
width:900px; 
height:90px; 
margin: 0 auto; 
} 

.navibtn001{ 

background:url(images/automart.jpg) no-repeat; 
width:200px; 
height:90px; 
} 

.navibtn002{ 
background:url(images/cab.jpg) no-repeat; 
width:900px; 
height:90px; 
} 


#logo002{ 
     padding-top: 30px; 
     margin: 0 auto; 
     width: 890px; 
     voice-family: "\"}\""; 
     voice-family:inherit; 
     width: 850px; 
} 

/************ 
html>body #logo { width: 850px } /* for opera */ 
/* 
#logo a:hover { 
     text-decoration: none; 
} */ 
/* 
#logo a { 
     float: left; 
     background: url("images/logo.jpg") no-repeat 0px 0px; 
     width: 317px; 
     height: 85px; 
} 

*******************/ 



/*---------- Divs ----------*/ 
#flsh{ 
background:url(images/vans/56%20dolpin/flv002.swf) no-repeat left top;width:640px;height:480px; 
height: 500px; 
width: 650px; 
margin: 0 auto; 

} 



/*******************/ 


#menubutton{ 
width:100%; 
height:20px; 
text-align:center; 
} 


#container { 
     width: 100%; 
     overflow: hidden; 
     text-align: left; 
     font: 90% Tahoma, Helvetica, sans-serif; 
     margin: 0px auto; 
     border-top: 3px solid #6fb2e6; 
     border-bottom: 3px solid #ffb93f; 
     background: #e5e5e5; 
} 
* html #container { 
     overflow: visible; 
} 

#content{ 
     float: right; 
     width: 690px; 
     background: #fff url(images/nav-edge.jpg) repeat-y; 
     padding-bottom: 40px; 
     min-height: 380px; 
} 
* html #content {height: 380px; overflow: visible;} 

#maincontent { 
     float: left; 
     float: right; 
     padding: 30px 20px 0px 20px; 
     overflow: hidden; 
     width: 450px; 
     voice-family: "\"}\""; 
     voice-family:inherit; 
     width: 410px; 
} 

#maincontent001 { 
     float: left; 
    /* float: right;*/ 
     padding: 30px 20px 0px 20px; 
     overflow: hidden; 
     width: 450px; 
     voice-family: "\"}\""; 
     voice-family:inherit; 
     width: 650px; 
} 


#rightdiv{ 
     padding-top: 30px; 
     float: right; 
     width: 230px; 
} 

#rightdiv img{ 
     padding: 1px; 
     border: 1px solid #6fb2e6; 
} 

#news{ 
     width: 210px; 
     margin: 0 auto; 
} 

/*---------- Navigation Menu ----------*/ 
#navcontainer { 
     padding-top: 30px; 
     padding-left: 15px; 
     min-height: 380px; 
     float: left; 
     overflow: hidden; 
     width: 180px; 
} 
* html #navcontainer {height: 380px; overflow: visible;} 

.nav { 
    width: 170px; 
    position:absolute; 
    list-style-type: none; 
    margin: 0; 
    padding: 0px; 
    font-size: 105%; 
    left: 228px; 
    top: 13px; 
} 

.nav li { 
     text-align: left; 
     margin: 3px 1px; 
     padding: 0; 

} 

.nav li a { 
     border: 1px solid #52a3e2; 
     display: block; 
     padding: 4px 0 4px 10px; 
     background: #6fb2e6; 
     color: #e5ffff; 
     font-weight: bold; 
     text-decoration: none; 
     width: 170px; 
     voice-family: "\"}\""; 
     voice-family:inherit; 
     width: 160px; 
} 

.nav li a:hover { 
     background: #ffb93f; 
     color: #949494; 
     font-weight: bold; 
     cursor: pointer; 
} 

/*---------- Footer ----------*/ 
#footer { 
     height: 30px; 
     margin: 0 auto; 
     padding: 10px 0 10px 0; 
     font-size: 80%; 
     text-align: center; 
     color: #6a6666; 
     width: 890px; 
     background: #fff; 
} 

#footerimg{ 
background:url("images/footer.jpg") no-repeat left top;width:890px;height:133px; 
     height: 133px; 
     width: 900px; 
     margin: 0 auto; 
     } 

#footeradd{ 
background:url(images/carsalelogo.jpg)no-repeat left top;width:890px;height:133px; 
height: 133px; 
width: 900px; 
margin: 0 auto; 

} 



#footertextleft{ 
     margin-left: 10px; 
     text-align: left; 
     width: 450px; 
     float: left; 
} 

#footertextright{ 
     margin-right: 10px; 
     text-align: right; 
     width: 350px; 
     float: right; 
} 

/*---------- Headings ----------*/ 
h1 { 
     padding-top: 0; 
     margin-top: 0; 
     font: 120% Arial; 
     font-weight: bold; 
     color: #5c94bf; 
} 

.mainheading{ 
     font-weight: bold; 
     font-size: 123%;  
} 

h2 { 
     padding-top: 0px; 
     margin-top: 0px; 
     font: 110% arial; 
     font-weight: bold; 
     color: #5c94bf; 
} 

#subtext{ 
     padding-top: 0px; 
     margin-top: 0px; 
     font: 110% arial; 
     font-weight: bold; 
     color: #5c94bf; 
} 




/*---------- Classes ----------*/ 
.underline{ 
     padding-bottom: 3px; 
     width: 180px; 
     border-bottom: 2px solid #ffb93f; 
} 

.subheading{ 
     font-weight: bold; 
} 

.submitbox{ 
     width: 215px; 
     background: #b8d1e4; 
     padding: 5px; 
     text-align: left; 
     border: 1px solid #e5e5e5; 
} 

.submitbox p{ 
     margin-top: 3px; 
     margin-bottom: 5px; 
} 

.submitbox button{ 
     font-size: 95%; 
     background: #e5e5e5; 
     color: #949494; 
     border: none; 
     padding: 3px 8px; 
     font-weight: bold; 
} 

#maincontent ul{ 
     list-style-image: url(images/bullet.png) 
} 

.advert{ 
     width: 160px; 
     padding: 5px; 
     background: #fff; 
     border: 1px solid #c8c8c8; 
} 

回答

3

添加margin: 0 auto;到:

#anti-shadow-div { 
    display: table; 
    overflow: hidden; 
    margin: 0 auto; 
} 
相關問題