居中网页 - 我错过了什么?

时间:2015-02-02 22:33:35

标签: css

我不知道自己错过了什么。我只是试图将页面居中,而我所做的一切都在起作用。我有" align-items:center;" ...不会这样做的包装器?请帮帮我。这是当前的代码:



#Table_01 {
  position: absolute;
  left: 0px;
  top: 0px;
  width: 850px;
}
#wrapper {
  align-items: center;
}
#themeBG {
  position: absolute;
  left: 0px;
  top: 0px;
  width: 849px;
  height: 333px;
}
#inThisIssue {
  position: absolute;
  left: 0px;
  top: 333px;
  width: 266px;
  height: 65px;
}
#headlineNewDept {
  position: absolute;
  left: 266px;
  top: 333px;
  width: 584px;
  height: 65px;
}
#sidebar {
  position: absolute;
  left: 0px;
  top: 398px;
  width: 266px;
  height: 2148px;
}
#main {
  position: absolute;
  left: 266px;
  top: 398px;
  width: 583px;
  height: 2149px;
  text-align: left;
}

<div align="center" id="wrapper">

  <div id="Table_01">
    <div id="themeBG">
      <img src="images/themeBG.jpg" width="849" height="333" alt="march image">
    </div>
    <div id="inThisIssue">
      <img src="images/inThisIssue.jpg" width="266" height="65" alt="in this issue...">
    </div>
    <div id="headlineNewDept">
      <img src="images/headlineNewDept.png" width="584" height="65" alt="headline - Our New Dept News">
    </div>
    <div id="sidebar">
      <img src="images/sidebar.jpg" width="266" height="2148" alt="">
    </div>
    <div id="main">Main content.</div>
  </div>
</div>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

#Table_01 {
margin:0 auto;
width:850px;
position:relative;
}

左边的绝对位置会将它猛击到左边。试试上面的内容。