用户名  找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2945|回复: 3

[其他未分类] Cross-Browser CSS Gradient〖跨浏览器的CSS渐变〗

[复制链接]
发表于 2011-1-7 09:19:09 | 显示全部楼层 |阅读模式 来自 中国–陕西–咸阳
For Webkit Browsers


The CSS gradient feature was introduced by Webkit for about two years but was rarely used due to incompatibility with most browers.But now with the Firefox 3.6+, which supports gradient, we can style create gradient without having to create an image. This post will show you how to code for the CSS gradient to be supported by the major browsers:IE, Firefox 3.6+, Safari, and Chrome. Also, check out my updated dropdown menu ( demo ) using CSS gradient.
The following line of code is for webkit browsers such as Safari, Chrome, etc. It will display a lineargradient from top (#ccc) to bottom (#000).
background: -webkit-gradient(linear, left top, left bottom, from(#ccc), to(#000));

发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;

如何回报帮助你解决问题的坛友,好办法就是点击帖子下方的评分按钮给对方加【金币】不会扣除自己的积分,做一个热心并受欢迎的人!

发表于 2011-1-7 09:20:35 | 显示全部楼层 来自 中国–陕西–咸阳
For Firefox 3.6+
background: -moz-linear-gradient(top,  #ccc,  #000);
For Internet Explorer
The following filter wlil only be read by IE:
filter: progidXImageTransform.Microsoft.gradient(startColorstr='#cccccc',endColorstr='#000000');
Cross-Browser CSS Gradient( demo )
Put the three lines of code from above together and the result is a cross-browser gradient box. Note: I added a background rule at the very top in case the user is using a browser that doesn’t support the feature.
background: # 999 ;  /* for non-css3 browsers */ filter: progidXImageTransform.Microsoft.gradient(startColorstr= '#cccccc' , endColorstr= '#000000' );  /* for IE*/ background: -webkit-gradient(linear, left top, left bottom, from(#ccc), to(# 000 ));  /*for webkit browsers */ background: -moz-linear-gradient(top,  #ccc,  # 000 );  /* for firefox 3.6+ */
gradient box
CSS Gradient Dropdown Menu
Below is a pure CSS gradient dropdown menu using CSS3 text-shadow, radius-border, and box-shadow (no Javascript or image)
css gradient dropdown
Internet Explorer Limitati**
Internet Explorer gradient filter doesn’t support color-stop, gradient angle, and radial gradient. That means you can only specify either horizontal or vertical linear gradient with 2 colors: StartColorStr and EndColorStr.
Final Remarks
Please note not all browsers support CSS gradient. To be safe,you shouldn’t rely on CSS gradient when coding the layout. It should only be used for enhancing the layout.
PS: in IE: filter: progidXImageTransform.Microsoft.gradient(GradientType=1, startColorstr=’#cccccc’, endColorstr=’#000000′); for horizontal, and replace the 1 witha 0 for vertical.
not support Opera

发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;

如何回报帮助你解决问题的坛友,好办法就是点击帖子下方的评分按钮给对方加【金币】不会扣除自己的积分,做一个热心并受欢迎的人!

回复 支持 反对

举报

发表于 2011-2-28 13:04:55 | 显示全部楼层 来自 中国–广东–中山
搞错啊 这么多中国人

发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;

如何回报帮助你解决问题的坛友,好办法就是点击帖子下方的评分按钮给对方加【金币】不会扣除自己的积分,做一个热心并受欢迎的人!

回复 支持 反对

举报

发表于 2011-3-10 22:22:20 | 显示全部楼层 来自 中国–河南–郑州
看不懂英文

发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;

如何回报帮助你解决问题的坛友,好办法就是点击帖子下方的评分按钮给对方加【金币】不会扣除自己的积分,做一个热心并受欢迎的人!

回复 支持 反对

举报

▶专业解决各类DiscuzX疑难杂症、discuz版本升级 、网站搬家 和 云服务器销售!▶有偿服务QQ 860855665 更多精品应用
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

站长推荐

在飘仙这里购买服务器空间的好处

1、凡是在飘仙这边购买服务器空间的,飘仙所提供的服务都超出了空间商本身的义务

      在飘仙这里 飘仙会大家尽量少走冤枉路,不花冤枉钱 

2、服务器空间质量可靠,价格优惠,8折优惠长期折扣,不玩套路! 

    所谓套路就是:新用户首单超低配置的服务器空间 给个很大的折扣(还鼓励一次购买多年),表明看起来价格很低,等升级续费或二次购买的时候 价格爆贵!——新手大多不能准确估算自己需要什么样的配置

查看 »

QQ|侵权投诉|广告报价|手机版|小黑屋|西部数码代理|飘仙建站论坛 ( 豫ICP备2022021143号-1 )

GMT+8, 2025-4-13 07:47 , Processed in 0.065375 second(s), 12 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表