2012-08-13 139 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-轨知道了您的图像