CSS屏幕大小

  • 本文关键字:屏幕 CSS css screen
  • 更新时间 :
  • 英文 :


在我的网站上,我正在做一个新的页面。当我在一个更大的屏幕上看它时,盒子在左边。我试着让它左对齐。

CSS:

.contactbox {
    width: 200px;
    height: auto;
    margin-left: 400px;
    left: 400px;
    padding: 12px
    background-color:#F5F5F5;
    border: 1px solid #9C9C9C;
    text-align: left;
    box-shadow: 2px 2px 7px 2px #DBDBDB;
    -moz-box-shadow:2px 2px 7px 2px #DBDBDB;
    -webkit-box-shadow:2px 2px 7px 2px #DBDBDB;  
}

margin: 0 auto;代替margin-left: 400px;。这将自动使左右边距相等,使div居中。

编辑:

像这样左移400px:

.contactbox {
  margin: 0 auto;
  // Allow it to be moved relative to its original (centered) position
  position: relative;
  // Move to the left (left means the left edge not the direction of movement)
  left: -400px;
}

最新更新