为什么我的主要图片不在Chrome的中心?

时间:2012-06-21 08:59:18

标签: html css

在Firefox中看起来不错,但图像没有显示在中心。

在Chrome中,图片未在浏览器窗口的中心对齐

如果您刷新浏览器,它会与中心和中心对齐然后在几秒钟后回到左边。

谢谢你的帮助。 这是Demo Template. 谢谢。

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;
}

1 个答案:

答案 0 :(得分:3)

margin: 0 auto;添加到:

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