2016-07-31 130 views
-2

我有一個div元素width:90%;margin: 80px auto;。該html有一個固定的背景圖像。當我添加一個鏈接到引導程序時,div的左右邊距用白色填充。如何解決這個問題呢?Div保證金問題

<div class="header-container"> 
    <div class="logo"> 
     <header> 
      <h5>royal apartments for you</h5> 
       <ul id="menu"> 
        <li><a href="index.html">Main</a></li> 
        <li><a href="#">Apartments</a></li> 
        <li><a href="#">Services</a></li> 
        <li><a href="#">Blog</a></li> 
        <li><a href="#">Contacts</a></li> 
       </ul> 
     </header> 
    </div> 
    <div class="slider"> 

    </div> 
</div> 

CSS:

html { 
    background: url(images/146987895643799.jpg) no-repeat center center fixed; 
    -webkit-background-size: cover; 
    -moz-background-size: cover; 
    -o-background-size: cover; 
    background-size: cover; 
} 

.header-container{ 
    width: 92%; 
    margin: 80px auto 0 auto; 
} 

.logo{ 
    background-color: #9fcb00; 
    height: 350px; 
} 

我已將此添加到HTML: <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">

+0

這有點難以給你任何建議沒有一點信息。什麼鏈接到自舉?什麼是基本的容器層次結構?應該發生什麼? –

回答

1

使用元素督察瀏覽器的開發者工具。看看你得到不想要的樣式的元素(即白色背景)。找出它們來自哪裏。然後刪除它們或覆蓋它們。

Bootstrap將身體的背景顏色設置爲白色。這涵蓋了HTML元素的背景。爲身體寫一個不同的風格來改變它。