html-CSS不透明度不同于1或0在IE11中不起作用 [英] html - CSS Opacity different than 1 or 0 not working in IE11
问题描述
我在使用Internet Explorer 11时遇到CSS属性不透明度的问题.代码很简单:
I'm facing an issue with the css property opacity, with Internet Explorer 11. The code is very simple:
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<style>
div{
width:100px;
height: 100px;
background: blue;
}
#d1{
opacity: 1;
}
#d2{
opacity: 0.7;
}
</style>
</head>
<body>
<div id='d1'>df</div>
<div id='d2'>trtret</div>
</body>
</html>
在IE11上,不透明度设置不适用于第二个div.所有其他浏览器都可以.我正在通过本地uWamp使用Apache服务器(因此,这是一个localhost网站,但在线时同样如此).
On IE11, the opacity setting doesn't work for the second div. All others browsers are fine. I'm using Apache server through local uWamp (so it's a localhost website, but same matter when put online).
我知道关于该主题还有其他主题,但是到目前为止他们还没有帮助...
I know there are others topics on the subject, but no help from them so far...
使用开发人员工具,我发现IE将不透明度设置为0: IE中的不透明性错误
Using the developer tools, I discovered that the opacity is set to 0 by IE: Wrong opacity in IE
推荐答案
使用背景色的技巧可行,但是meta标签没有任何改变.
The trick with background-color worked, but the meta tag didn't change anything.
最后,我通过删除IE缓存("工具-> Internet选项->常规->删除...
")来使不透明" css工作.
Finally I got the "opacity" css working by deleting the IE cache (tools --> internet options --> general --> delete...
).
这篇关于html-CSS不透明度不同于1或0在IE11中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!