如何获得垂直渐变背景在所有浏览器中工作? [英] How to get a vertical gradient background to work in all browsers?

查看:109
本文介绍了如何获得垂直渐变背景在所有浏览器中工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果你想得到从白色到灰色阴影的垂直渐变背景,你会怎么做呢?

If you were to get a vertical gradient background starting from white down to some shade of grey, how would you do it?

推荐答案

您可以使用CSS执行此操作,请查看此链接

You can do it with CSS, check out this link.

在使用IE时,它在良好的浏览器中使用CSS3属性,并使用IE的 filter >

CSS



It uses CSS3 properties in good browsers, and IE's propriety filter property when using IE.

#gradient {
    background: #FFFFFF; /* old browsers */
    background: -moz-linear-gradient(top, #FFFFFF 0%, #CCCCCC 100%); /* firefox */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#FFFFFF), color-stop(100%,#CCCCCC)); /* webkit */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#FFFFFF', endColorstr='#CCCCCC',GradientType=0 ); /* ie */
}

... produce ...

这篇关于如何获得垂直渐变背景在所有浏览器中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆