Home >Web Front-end >JS Tutorial >How to resolve the compatibility issues with transparency in IE 6, 7, and 8

How to resolve the compatibility issues with transparency in IE 6, 7, and 8

一个新手
一个新手Original
2017-10-11 09:54:471463browse

This is my first time writing a blog, let me write about the problems I encountered today

When I was doing page transparency today, I used IE7 to test it and found that it had no effect. The original code is as follows

.mask {
	width: 100%;
	height: 100%;
	position: fixed;
	left: 0;
	top: 0;
	background: rgba(0,0,0,.2);
	display: none;
}

In this case, it was found that it was incompatible, so I used another way of writing, set a background, and then set the opacity attribute to 0.4. I found that it still didn't work. I asked the teacher and found out that I need to add a line to achieve compatibility with IE6, 7, and 8

The changed code is as follows:

.mask {
	width: 100%;
	height: 100%;
	position: fixed;
	left: 0;
	top: 0;
	background-color: #000;
	opacity: 0.2;
	filter: alpha(opacity = 20);/* 兼容IE6、7、8 */
	display: none;
}

This way it will be perfectly compatible with IE.

The above is the detailed content of How to resolve the compatibility issues with transparency in IE 6, 7, and 8. For more information, please follow other related articles on the PHP Chinese website!

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