兼容低版本IE浏览器的背景颜色渐变效果_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:29:19
Original
1195 people have browsed it

兼容低版本IE浏览器的背景颜色渐变效果:
大多数的兼容性问题都是由于低版本的IE浏览器所导致的,本章节分享一段代码实例,它能够实现背景的颜色的渐变效果,如果在标准浏览器中直接采用css3属性即可实现,但是IE低版本的问题所以需要进行一下兼容性处理。
代码如下:

<!DOCTYPE html><html><head><meta charset=" utf-8"><meta name="author" content="http://www.softwhy.com/" /><title>蚂蚁部落</title><style type="text/css">.gradient{  background:#000000;  background:-moz-linear-gradient(top, #000000 0%, #ffffff 100%);  background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #000000), color-stop(100%, #ffffff));  background:-webkit-linear-gradient(top, #000000 0%, #ffffff 100%);  background:-o-linear-gradient(top, #000000 0%, #ffffff 100%);  background:-ms-linear-gradient(top, #000000 0%, #ffffff 100%);  background:linear-gradient(to bottom, #000000 0%, #ffffff 100%);  filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#000000',endColorstr='#ffffff',GradientType=0);  width:300px;  height:100px;  margin:0px auto;}:root .gradient{filter:none;}</style></head><body><div class="gradient"></div></body></html>
Copy after login

上面的代码实现了我们的要求,标准浏览器使用的linear-gradient属性,而低版本的IE浏览器则是使用的滤镜效果。

原文地址是:http://www.softwhy.com/forum.php?mod=viewthread&tid=14244

更多内容可以参阅:http://www.softwhy.com/divcss/

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!