2013-03-30 27 views
2

我一直在擺弄我的Pytheas theme再次。這一次,我正在嘗試在我的頁面和帖子的背景上插入一張2色gif(適合拼貼)。請注意,我做的不是是指整個頁面的背景。那就是,應該保持黑色。相關網站/示例帖子是here如何將重複的平鋪圖像插入WordPress頁面或帖子的背景(而非頁面背景)?

我已經進行了廣泛調查,因爲我可以給我的編碼缺陷。目前,我一直在編輯styles.css文件。我換成這個默認代碼:

/* Body & Main 
================================================== */ 
body { background: #eee url("images/main-bg.png") repeat; nowhitespace: afterproperty; font: 12px/1.8 'Helvetica Neue', Helvetica, Arial, sans-serif; color: #444; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; } 
body a { color: #f15a23 } /*main link color*/ 
body a:hover { text-decoration: none; color: #000 } 

與此修訂代碼,我與我的CSS的朦朧認識拼湊起來。

body { 
    background: url("http://longgame.org/wp-content/uploads/grid-paper-2color-start.gif") repeat; nowhitespace: afterproperty; 
    background-repeat: repeat; 
    background-color:rgba(255,255,255,0.0); 
    font: 12px/1.8 'Helvetica Neue', Helvetica, Arial, sans-serif; color: #444; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; 
} 

我的想法是,我需要的是RGBA位,以確保顏色是透明的(如果紋理是「落後」的話)。我不知道。我正在擲飛鏢。也許它是在錯誤的地方。也許這只是錯誤的。 :)

我轉向你更合格的人來幫助我。預先感謝您提供的任何指導。

回答

1

,而不是設置你的body元素的CSS,試試也把它放在#main-content

,你只需要在第一線達到你想要的效果:如果你不

#main-content { 
    background: url("http://longgame.org/wp-content/uploads/grid-paper-2color-start.gif") repeat; 
} 
+1

完美!那是不快的。非常感謝你,metadept。 – DocBadwrench

+0

@DocBadwrench非常歡迎:) – metadept

0

希望整個頁面的背景都受到影響,但只有WordPress頁面/帖子的背景,您不應該在CSS中調整body元素的正確背景,這會影響整個HTML頁面,而是您要應用背景的元素,可能是#main-content

嘗試在您的CSS文件的第24行附近設置#main-content的背景屬性,例如,

#main-content { 
    background: url("http://longgame.org/wp-content/uploads/grid-paper-2color-start.gif") repeat; 
} 
+0

我剛剛注意到你也發佈了正確的方法。 :) 謝謝! – DocBadwrench