2014-02-28 18 views
0

我完全難以在現有網站上應用重複背景圖片。我通常從頭開發相對簡單的網站,並且不熟悉操縱現有更復雜的代碼,所以我可能會錯過某些顯而易見的東西,但這裏就是這樣。現有樣式表中的背景圖片

我正在處理帶有多個div和容器的頁面和樣式表,其中可見內容被限制爲800px的寬度。我一直試圖在樣式表中應用一個重複的bg圖像,並且它似乎沒有影響。

這個樣式表中除了身體標記之外,還有哪些地方是我應該看的?有人可能幫助我與其他地方,你會經常看,例如。容器的CSS,divs等?

非常感謝!

編輯:這是可能幫助的代碼片段。我嘗試應用到容器,但沒有骰子:

html { 
    margin: 0; 
    /* setting border: 0 hoses ie6 win window inner well border */ 
    padding: 0; 
} 

body { 
    margin: 0; 
    /* setting border: 0 hoses ie5 win window inner well border */ 
    padding: 0; 
    font-family: verdana, 'trebuchet ms', sans-serif; 
    font-size: 12px; 
    background-image:url("pix/cork.jpg"); 
    background-repeat:repeat; 
} 

form { margin: 0; padding: 0; } 
a { text-decoration: underline; } 
a img { border: 0; } 

h1, h2, h3, h4, h5, h6 { font-weight: normal; } 
h1, h2, h3, h4, h5, h6, p, ol, ul, pre, blockquote { 
    margin-top: 10px; 
    margin-bottom: 10px; 
} 

/* standard helper classes */ 

.clr { 
    clear: both; 
    overflow: hidden; 
    width: 1px; 
    height: 1px; 
    margin: 0 -1px -1px 0; 
    border: 0; 
    padding: 0; 
    font-size: 0; 
    line-height: 0; 
} 

/* .pkg class wraps enclosing block element around inner floated elements */ 
.pkg:after { 
    content: " "; 
    display: block; 
    visibility: hidden; 
    clear: both; 
    height: 0.1px; 
    font-size: 0.1em; 
    line-height: 0; 
} 
* html .pkg { display: inline-block; } 
/* no ie mac \*/ 
* html .pkg { height: 1%; } 
.pkg { display: block; } 
/* */ 


/* page layout */ 

body { 
    text-align: center; 
} /* center on ie */ 

#container { 
    position: relative; 
    margin: 0 10 auto; /* center on everything else */ 
    width: 420px; 
    text-align: left; 
} 
#container-inner { position: static; width: 400px; } 

#banner { position: relative; } 
#banner-inner { position: static; } 

#pagebody { position: relative; width: 100%; background-color:#fff; margin-top:120px; } 
#pagebody-inner { position: static; width: 100%; } 

#alpha, #beta, #gamma, #delta { 
    display: inline; /* ie win bugfix */ 
    position: relative; 
    float: left; 
    min-height: 1px; 
} 

#delta { float: right; } 

#alpha-inner, #beta-inner, #gamma-inner, #delta-inner { 
    position: static; 
} 
+0

沒有你的代碼,這是很難分辨... –

+0

我很遺憾,在哪裏看,我不得不張貼整個頁面,這將是艱鉅的。想知道是否有人願意讓我通過電子郵件向他們發送文件? – user3358145

+0

是的,所以SO並不是那種方式。你需要有一個[Short,Self Contained,Correct Example](http://www.sscce.org/)以便我們真正幫助你。 –

回答

0

我認爲你正在尋找標籤和容器來實現css。以下是可能有所幫助的示例 -

<html> 
<head> 
<title>MyPage</title> 
<style> 
body{ 
background-color:#06F; 
} 
#container { 
width:800px; 
background-repeat:repeat; /* you can use repeat-x/repeat-y/no-repeat also*/ 
background:url(path/image.JPG); 
} 
</style> 
</head> 
<body> 
<div id="container"></div 
</body> 
</html> 

您當然需要發佈您的代碼。

+0

非常感謝您嘗試,儘管我在這裏模糊不清。我添加了很多代碼來查看它是否有幫助。我嘗試應用背景CSS到容器,但它似乎沒有工作。 – user3358145