Home  >  Article  >  Web Front-end  >  <body>的background-image和background-color层次问题_html/css_WEB-ITnose

<body>的background-image和background-color层次问题_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-21 09:48:381864browse

body {		background-image:url(pics/bg.png);		background-repeat:repeat;		background-color:#069;}

设置成这样,但背景颜色总是会覆盖在背景图片上,怎么能让背景图片在背景颜色上从而不受背景颜色影响?

回复讨论(解决方案)

你路径写错了呗。

背景图片,会覆盖背景色的,看下路径,在调试工具里,看下这个图片,是不是成功加载过来了。

图片路径不对吧

你路径写错了呗。

背景图片,会覆盖背景色的,看下路径,在调试工具里,看下这个图片,是不是成功加载过来了。
很确定背景图片已经加载了,和背景颜色叠加在一起出现了奇特的效果。

你确定加载了,那就看下,body下的第一个子元素,是不是占据整个body的,是不是你在这个子元素上面,设置了颜色。

再仔细检查下你的代码,颜色覆盖背景图片。还真是没有见过。

你把body的颜色去掉,看看会不会出背景色,就能确定,是不是背景图片被颜色覆盖了。

background:#069 url(pics/bg.png) no-repeat center center;

你的背景图片是png格式的,不要告诉我,撒是png这个你不懂

你的背景图片是png格式的,不要告诉我,撒是png这个你不懂
好吧,是图片半透明了

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn