• 边框、背景渐变的按钮效果


    这两天遇到了个按钮效果,要求背景、边框做颜色渐变,hover状态时还需要有弥散投影的效果(设计稿中弥散投影也有渐变),因为是统一样式,希望能够用起来简便,做起来着实费了点劲(尤其是那个边框渐变),效果如图:

    1 .btn-current{display: inline-block;font-size: 12px;color: #699ffa;padding: 1px 30px; vertical-align: middle;text-align: center; position: absolute;border-radius: 2px;z-index: 10;cursor: pointer;background: -webkit-linear-gradient(left, #77aaff, #7fc7ff);background: -o-linear-gradient(left, #77aaff, #7fc7ff);background: linear-gradient(to right, #77aaff, #7fc7ff);}
    2 .btn-current:hover, .btn-current.active{color: #fff;}
    3 .btn-current:hover:before{content: '';display: inline-block;height: 14px;position: absolute;bottom: -5px;left: 6px;right: 6px;z-index: -1;-webkit-filter: blur(5px) brightness(0.88);filter: blur(20px) brightness(0.95);background: -webkit-linear-gradient(left,#77aaff,#7fc7ff);background: -moz-linear-gradient(left,#77aaff,#7fc7ff);background: linear-gradient(to right, #77aaff, #7fc7ff);}
    4 .btn-current:after{content: '';display: inline-block;position: absolute;left: 2px;top: 2px;height: calc(100% - 4px);width: calc(100% - 4px);background: #fff;z-index: -1;}
    5 .btn-current:hover:after, .btn-current.active:after{width: 100%;height: 100%;top: 0;left: 0;border-radius: 2px;background: -webkit-linear-gradient(left, #77aaff, #7fc7ff);background: -o-linear-gradient(left, #77aaff, #7fc7ff);background: linear-gradient(to right, #77aaff, #7fc7ff);}
    6 .btn-current-disabled{display: inline-block;color: rgba(0, 0, 0, 0.26);border: 2px solid #bdbdbd;padding: 0px 30px;font-size: 12px;border-radius: 2px;cursor: no-drop;}
    <span class="btn-current">导入</span>
    <span class="btn-current active">导入</span>
    <span class="btn-current-disabled">导入</span>

    抛砖引玉,有更好的方法的,还请大家share下啊

  • 相关阅读:
    webform文件上传加水印
    2017-6-6 ASP.NET Ajax版页面无刷新三级联动
    2017-6-5 Ajax应用
    转【 正则表达式】
    2017-6-4 JQuery中的选择器和动画 弹窗遮罩
    Linq 组合分页查询
    2017-6-2 Linq高级查询和函数
    2017-6-3 JQuery中的Dom操作和事件
    WebForm母版页
    WebForm内置对象:Application和ViewState、Repeater的Command用法
  • 原文地址:https://www.cnblogs.com/ycx0317/p/5725383.html
Copyright © 2020-2023  润新知