2014-09-10 96 views
0

我在CSS初學者,我試着做出頭,但我遇到了一些問題,在這裏是我的問題CSS背景重複-X的問題

我有CSS代碼這個和平水平重複背景,但我想背景涵蓋正是我寫的不多(有下我寫的東西顯示額外的顏色,我無法上傳我的照片)

<!DOCTYPE html> 
<html> 
<head> 

<style> 
.Container_16 { 
margin-left:auto; 
margin-right:auto; 
width:960px; 


} 

.Container_5 { 

float:left; 

} 
#Title { 
font-size:68px; 
font-family:sans-serif; 
} 
.Container_11{ 

float:left; 

color:white; 
} 
li{ 
list-style-type:none; 
display:inline; 
padding-left:15px; 
color:white; 
font-size:20px; 
font-family:sans-serif; 
margin-top:30px; 
} 
nav{ 
margin-left:150px; 
text-align:right; 
margin-top:30px; 
margin-right:250px; 
} 

body{ 
min-width:960px; 
background-image:url("bg.png"); 
background-repeat:repeat-x; 

} 

</style> 
<body> 
<div class="Container_16"> 
<div class="Container_5" id="Title"><a href="http://www.facebook.com" target="_blank">Book.me</a>  </div> 
<div class="Container_11"><nav> 
<ul> 
<li>one</li> 
<li>Two</li> 
<li>Three</li> 
<li>Four</li> 
</ul> 
</nav></div> 
</div> 

</body> 
</head> 
</html> 
+0

那麼,有什麼問題呢? '身體'有100%的設備,所以你會看到圖像重複100%。 – Justinas 2014-09-10 10:41:51

+0

當我重複它的顏色是不是隻覆蓋我想要的塊,但它下面幾乎80px下 – user3560518 2014-09-10 11:07:24

回答

0

要只適用背景圖片至Facebook的鏈接,使用這個CSS:

#title > a { 
    background: url('bg.png') repeat-x; 
} 
0

因爲您將background設置爲body。我看到你有<div class="Container_16"> 其中你有所有的文字。所以你可以只將背景設置爲該div。

CSS

body{ 
min-width:960px; 
} 
.Container_16 { 
margin-left:auto; 
margin-right:auto; 
width:960px; 
height:100px; 
background-image:url("image.png"); 
background-repeat:repeat-x; 
} 

DEMO