2010-08-30 90 views
0

实施例的代码后的背景​​色:背景图像并且在一个DIV

<div class="ex">Bla bla bla bla</div> 

在顶部将是背景图像,并且当它会完成显示背景图像之后,它会DISPLY背景色。

财产以后这样的:

[Image] text 
[color] more text 
[color] mor text.. 

如何用CSS做呢?

谢谢。

回答

5
background: url("img/folder/file.jpg") repeat-x #000000; 

更改十六进制为任何你需要的颜色。

+0

如果我想在底部的另一背景图片?我可以再次(颜色后)“url(”img/folder/file.jpg“)repeat-x”? – Luis 2010-08-30 12:56:24

+1

在CSS3中有一个更简单的方法来做到这一点,但你遇到了兼容性问题。你需要在div里面放一个div'

' - 为child_ex设置背景属性,现在你有另一个背景。 – bradenkeith 2010-08-30 13:12:49

0

尝试使用背景图像重复属性:

background-repeat: repeat | repeat-x | repeat-y | no-repeat