Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 不透明度属性有一些问题_Css - Fatal编程技术网

Css 不透明度属性有一些问题

Css 不透明度属性有一些问题,css,Css,我希望我的HTML背景透明度为.9,但由于某些原因,它不起作用。为什么会这样我真的不明白 CSS html{ background: url(http://img.pixland.uz/u841f174959.jpg ) no-repeat center center fixed; background-size: cover; opacity: 1; <!-- if i decrease opacity 1 to 0.9 it will become very small

我希望我的HTML背景透明度为
.9
,但由于某些原因,它不起作用。为什么会这样我真的不明白

CSS

html{
  background: url(http://img.pixland.uz/u841f174959.jpg
  ) no-repeat center center fixed;
  background-size: cover;
  opacity: 1; <!-- if i decrease opacity 1 to 0.9 it will become very small   -->
}
html{
背景:url(http://img.pixland.uz/u841f174959.jpg
)无重复中心固定;
背景尺寸:封面;
不透明度:1;
}

CSS


如果您只是想获得所需的效果,则应更改CSS规则以应用于body标记,而不是html。如下所示:

html{ /*Used this to test the opacity thing*/
    background:#000;
}
body{
  background: url(http://img.pixland.uz/u841f174959.jpg
  ) no-repeat center center fixed;
  background-size: cover;
  opacity: 0.5;
    position:absolute;
    left:0;
    top:0;
    width:100%;
    height:100%;
}
我正在搜索,这就是为什么它不能在html标签上工作。


只要你不指定高度,你就错了

这样的不透明度设置将影响整个页面。。。为什么不改变图像本身的不透明度?如果你设置了不透明度,我想改变整个页面的不透明度…如果OP想从HTML中删除内容怎么办?!我的意思是,如果我想删除你的“aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa。所以在这个答案中,实际的不透明度水平是0.25。不透明度是一个小数点,但在这里:将一半设置为html,然后将另一半html设置为body,所以最后它是0.25。哦,“aaaaaa”只是显示所有内容的不透明度将如何改变。没有它也行@JanakaRRajapaksha-情况并非如此,在fiddle CSS中删除
body
,您将看到没有可见的不透明度更改。@先生,我看到它在从CSS fiddle中删除body后会更改不透明度。我用铬。我错了吗?
html{ /*Used this to test the opacity thing*/
    background:#000;
}
body{
  background: url(http://img.pixland.uz/u841f174959.jpg
  ) no-repeat center center fixed;
  background-size: cover;
  opacity: 0.5;
    position:absolute;
    left:0;
    top:0;
    width:100%;
    height:100%;
}
html{
    height:100%;
  background: url(http://img.pixland.uz/u841f174959.jpg
  ) no-repeat center center fixed;
  background-size: cover;
  opacity: 0.5; 
}