设为首页收藏本站关注微信<<< 抵制 IE6 人人有责 >>>
搜索
热搜: 活动 交友 discuz
查看: 2164|回复: 0
打印 上一主题 下一主题

[CSS3] CSS3自定义渐变圆角submit按钮样式

[复制链接]
跳转到指定楼层
楼主
发表于 2015-10-16 10:12:22 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
HTML5+CSS3 代表着下一代web开发技术,虽然标准规范还没有正式发布,但是未来的发展前景已经可以预见。
随着越来越多的主流浏览器对这些标准的支持,我们已经可以使用其中一些技术来美化页面了。例如下面要讲的自定义渐变圆角按钮样式,虽然有些浏览器还不支持,但我们有折中的方法,为这些不支持 CSS3 渐变圆角功能的浏览器提供降级方案。
不必再通过图片来创造具有渐变圆角效果的按钮,会方便很多。
首先来看下样式在各个浏览器中的效果:
Chrome,Safari,Firefox,Opera下的效果,完美支持!
IE9下的效果,仅支持圆角!
IE7、IE8下的效果,圆角渐变都不支持!
IE低版本真的很令人头疼,网上也有实现IE下渐变圆角效果的方法,比较繁琐。个人觉得没有必要,这个样式看起来还不错,也没有影响布局,可以就这样使用!
核心代码如下:
HTML 代码
[HTML] 纯文本查看 复制代码
<div class="main">
        <!--css3自定义渐变圆角按钮样式-->
            <input type="submit" class="btn-style-01" value="提交" />
        <!--css3自定义渐变圆角按钮样式-->
</div>


CSS代码
[CSS] 纯文本查看 复制代码
.btn-style-01{
    border-style:none;
    padding:8px 30px;
    line-height:24px;
    color:#fff;
    font:16px "Microsoft YaHei", Verdana, Geneva, sans-serif;
    cursor:pointer;
    border:1px #ae7d0a solid;
    -webkit-box-shadow:inset 0px 0px 1px #fff;
    -moz-box-shadow:inset 0px 0px 1px #fff;
    box-shadow:inset 0px 0px 1px #fff;/*内发光效果*/
    -webkit-border-radius:4px;
    -moz-border-radius:4px;
    border-radius:4px;/*边框圆角*/
    text-shadow:1px 1px 0px #b67f01;/*字体阴影效果*/
    background-color:#feb100;
    background-image: -webkit-gradient(linear, 0 0%, 0 100%, from(#feb100), to(#e8a201));
    background-image: -webkit-linear-gradient(top, #feb100 0%, #e8a201 100%);
    background-image: -moz-linear-gradient(top, #feb100 0%, #e8a201 100%);
    background-image: -ms-linear-gradient(top, #feb100 0%, #e8a201 100%);
    background-image: -o-linear-gradient(top, #feb100 0%, #e8a201 100%);
    background-image: linear-gradient(top, #feb100 0%, #e8a201 100%);/*颜色渐变效果*/
}
.btn-style-01:hover {
    background-color:#e8a201;
    background-image: -webkit-gradient(linear, 0 0%, 0 100%, from(#e8a201), to(#feb100));
    background-image: -webkit-linear-gradient(top, #e8a201 0%, #feb100 100%);
    background-image: -moz-linear-gradient(top, #e8a201 0%, #feb100 100%);
    background-image: -ms-linear-gradient(top, #e8a201 0%, #feb100 100%);
    background-image: -o-linear-gradient(top, #e8a201 0%, #feb100 100%);
    background-image: linear-gradient(top, #e8a201 0%, #feb100 100%);
}




源文出处: http://www.alleyloft.com/contents/share?id=2

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?免费注册

x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 转播转播 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

QQ|手机版|Archiver|源于生活(个人生活娱乐工作的笔记)css3,html5,学习笔记    

GMT+8, 2024-5-2 21:54 , Processed in 0.093600 second(s), 30 queries .

Powered by Mr.Kevin-ying

© 2004-2015

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