2012-08-13 141 views
1

的main.css

body{ 
    width:100%; 
    height:100%; 
    overflow:hidden; 
    background:url('/assets/background-calculations.png'); 
} 
body #content{ 
    z-index:5; 
    background:url('/assets/handwritten-text.png'); 
// background:white; 
    width:100%; 
    height:100px; 
} 
body #footer,#header{ 
    height:100px; 
    width:100%; 
    margin:0 auto; 
} 

index.html.erb是空白

疑問

,當我在內容的CSS取消註釋background:white;其工作,但是當我設置背景鏈接它不工作,但如果我將它設置爲內容的div相同的URL不能正常工作,請大家幫忙軌CSS設置背景圖片

+0

你能提供完整鏈接到背景圖片?沒有它:) – s0d4pop 2012-08-13 03:50:19

+0

目前談論的開發環境我無法檢查你的CSS的事情是,當我使用的背景圖片的身體,它的工作,但對於其他的div它不是例如 體{ 後臺工作 – Abhimanyu 2012-08-13 03:56:21

+0

:URL(」 /assets/handwritten-text.png'); } 是工作,但上面沒有 – Abhimanyu 2012-08-13 04:01:01

回答

1

試着這麼做;

body #content{ 
    z-index:5; 
    background-image:url('/assets/handwritten-text.png'); 
    background-color:white; 
    width:100%; 
    height:100px; 
} 

Here是一個工作現場演示。

+0

你看不到我的小提琴藍色的背景圖片? – 2012-08-13 11:30:42

+0

感謝您的幫助,它的工作完全正常 – Abhimanyu 2012-08-13 11:57:01

2

,如果你在的Ruby-on-軌工作,你有資產>圖像。把圖像放在那裏。

在樣式表文件夾(資產>樣式表),你必須指向圖像,而不是文件夾和圖像:

body{ 
    width:100%; 
    height:100%; 
    overflow:hidden; 
    background:url(background-calculations.png); 
} 
body #content{ 
    z-index:5; 
    background:url(handwritten-text.png); 
    width:100%; 
    height:100px; 
} 

的Ruby-on-軌知道了您的圖像