2013-11-27 117 views
0

我試圖將包裝類與屏幕的頂部和底部對齊,以便用戶向上/向下滾動身體背景時不顯示或留下間隙。CSS將包裝對齊到屏幕的頂部+底部

HTML和部分CSS如下所示;

CSS

body{ 
    font: 14px/18px 'Nunito', sans-serif Arial, Tahoma, Verdana, sans-serif; /* Normal text font */ 
    width: 100%; 
    height: 100%; 
    background:url('../img/bgs/bg-1.jpg'); /* Actual background */ 

    background-repeat: no-repeat; 
    background-size: 100% auto; 
    background-position: center top; 
    background-attachment: fixed; 
    margin:0px;   
} 
#wrapper 
{ 
    width: 1000px; 
    margin: 0 auto; 
    min-height: 100%; 
    height:100%; 
    height: auto !important; 
    background: white; 

} 

HTML

<body> 
      <div id="wrapper"> 

        <header id="header"> 
          more html + content 
        </header> 

        <div id="content"> 


          <div class="default_page"> 

            more html + content 

          </div> 

        </div> 
      </div> 



    </body> 

回答

2

您所看到的空間是保證金,崩到身體保證金。爲了防止這種情況,您可以簡單地將overflow: hidden添加到包裝和頁腳,或者將填充(分別爲頂部和底部)添加到它們。

+0

沒有工作,可以與其他css interfearing .. – IEnumerable

+0

對不起,錯誤的值。我編輯了答案。 –

+0

真棒是它! – IEnumerable