小编给大家分享一下Css技术中线性渐变的示例分析,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!
公司主营业务:成都网站设计、做网站、移动网站开发等业务。帮助企业客户真正实现互联网宣传,提高企业的竞争能力。创新互联建站是一支青春激扬、勤奋敬业、活力青春激扬、勤奋敬业、活力澎湃、和谐高效的团队。公司秉承以“开放、自由、严谨、自律”为核心的企业文化,感谢他们对我们的高要求,感谢他们从不同领域给我们带来的挑战,让我们激情的团队有机会用头脑与智慧不断的给客户带来惊喜。创新互联建站推出花垣免费做网站回馈大家。
对象选择器 {background:-浏览器前缀-linear-gradient(起点方向,起点颜色,终点颜色);}
径向渐变的语法
对象选择器 {background:-浏览器前缀-radial-gradient(起点方向,形状,大小,起点颜色,终点颜色);}
渐变的兼容方法
1、线性渐变
各浏览器前缀
(1)Firefox
(2)Safari , Chrome
(3)Opera 11.10+
兼容IE
2、径向渐变
径向渐变和线性渐变的语法差不多
渐变应用实例
1、径向渐变做大背景
background-color:#4B770A;background-image:-webkit-gradient(radial,50%400,1,50%400,400,from(rgba(255,255,255,0.3)),to(rgba(255,255,255,0)));//仅实现了webkit下的效果
2、蒙版效果
position:fixed;width:100%;height:60px;bottom:0px;content:'';background:-moz-linear-gradient(top,rgba(255,255,255,0)0%,rgba(255,255,255,0.33)33%,rgba(255,255,255,0.73)66%,rgba(255,255,255,1)91%);background:-webkit-gradient(linear,lefttop,leftbottom,color-stop(0%,rgba(255,255,255,0)),color-stop(33%,rgba(255,255,255,0.33)),color-stop(66%,rgba(255,255,255,0.73)),color-stop(91%,rgba(255,255,255,1)));background:-webkit-linear-gradient(top,rgba(255,255,255,0)0%,rgba(255,255,255,0.33)33%,rgba(255,255,255,0.73)66%,rgba(255,255,255,1)91%);background:-o-linear-gradient(top,rgba(255,255,255,0)0%,rgba(255,255,255,0.33)33%,rgba(255,255,255,0.73)66%,rgba(255,255,255,1)91%);background:-ms-linear-gradient(top,rgba(255,255,255,0)0%,rgba(255,255,255,0.33)33%,rgba(255,255,255,0.73)66%,rgba(255,255,255,1)91%);background:linear-gradient(top,rgba(255,255,255,0)0%,rgba(255,255,255,0.73)33%,rgba(255,255,255,0.73)66%,rgba(255,255,255,1)91%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ffffff',endColorstr='#ffffff',GradientType=0);
3、渐变按钮
.myButton{-moz-box-shadow:inset0px1px0px0px#ffffff;-webkit-box-shadow:inset0px1px0px0px#ffffff;box-shadow:inset0px1px0px0px#ffffff;background:-webkit-gradient(linear,lefttop,leftbottom,color-stop(0.05,#ededed),color-stop(1,#dfdfdf));background:-moz-linear-gradient(top,#ededed5%,#dfdfdf100%);background:-webkit-linear-gradient(top,#ededed5%,#dfdfdf100%);background:-o-linear-gradient(top,#ededed5%,#dfdfdf100%);background:-ms-linear-gradient(top,#ededed5%,#dfdfdf100%);background:linear-gradient(tobottom,#ededed5%,#dfdfdf100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed',endColorstr='#dfdfdf',GradientType=0);background-color:#ededed;-moz-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;border:1pxsolid#dcdcdc;display:inline-block;cursor:pointer;color:#777777;font-family:arial;font-size:15px;font-weight:bold;padding:6px24px;text-decoration:none;text-shadow:0px1px0px#ffffff;margin-top:100px;}.myButton:hover{background:-webkit-gradient(linear,lefttop,leftbottom,color-stop(0.05,#dfdfdf),color-stop(1,#ededed));background:-moz-linear-gradient(top,#dfdfdf5%,#ededed100%);background:-webkit-linear-gradient(top,#dfdfdf5%,#ededed100%);background:-o-linear-gradient(top,#dfdfdf5%,#ededed100%);background:-ms-linear-gradient(top,#dfdfdf5%,#ededed100%);background:linear-gradient(tobottom,#dfdfdf5%,#ededed100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#dfdfdf',endColorstr='#ededed',GradientType=0);background-color:#dfdfdf;}.myButton:active{position:relative;top:1px;}
以上是“Css技术中线性渐变的示例分析”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注创新互联行业资讯频道!