我正在尝试在带有背景图片的html页面顶部添加标题区域,以便显示一些内容。
以下是我正在编辑的主题的预览: http://live.bobosh.com/frontium/
我尝试添加:
<div class= "top">
.top {
width:100%;
height: 50px;
background-image: url ('/img/background.png') repeat-x;
position: fixed;
top: 0;
left: 0;
z-index: 999;
}
它只是向下推动所有东西而不显示我的背景图像。
感谢。
编辑:好的,我只能使用背景颜色和边框来让div看起来像我想要的那样,并且它固定在顶部。但是,它现在覆盖了我标题区的一部分。我希望它固定在顶部,但不希望它显示在我的任何其他内容上。我只是希望它显示在上面。我怎么能这样做?
感谢。
答案 0 :(得分:0)
look at this fiddle我认为/img/background.png中没有图像或路径错误
`background-image: url ('/img/background.png') repeat-x;`
删除repeat-x
并检查您是否希望自己可以添加
background-repeat:repeat-x;
到你的CSS