代码之家  ›  专栏  ›  技术社区  ›  bhups

如何使用包含线性渐变和背景色的纯CSS创建按钮

  •  0
  • bhups  · 技术社区  · 14 年前

    我如何创建按钮使用纯CSS与销售背景色,并在此基础上,在它的中心椭圆形状梯度。我不想使用任何外部图像。这里是示例按钮。
    在此示例中,背景为实心黑色,蓝色区域由两个线性渐变组成(从顶部(92b5fd)到中间(6094fc),然后从中间(4484fb)to bottom(44bbfc))
    i started using following piece of css but cannot figure out to get the desired result.

    .gradbutton width:620px;
    高度:60px;
    边框:1倍纯黑;
    填充:0px;
    背景:-WebKit渐变(线性,左上,左下,从(92bfd),到(6094fc),颜色停止(0.5,4484fb),颜色停止(0.5,44bbfc));
    背景位置:中心;
    轮廓:0;
    位置:绝对;
    顶部:60px;
    右:1px;
    Z-索引:9999;
    显示:块;
    }
    在此示例中,背景为实心黑色,蓝色区域由两个线性渐变组成(从顶部(92b5fd)到中间(6094fc),然后从中间(4484fb)到底部(44bbfc))。
    我开始使用下面的CSS,但没能找到想要的结果。

    .gradButton {width:620px;
    height:60px;
    border:1px solid black;
    padding: 0px;
    background: -webkit-gradient(linear, left top, left bottom, from(#92bffd), to(#6094fc), color-stop(0.5, #4484fb), color-stop(0.5, #44bbfc));
    background-position:center;
    outline:0;
    position:absolute;
    top:-60px;
    right:-1px;
    z-index:9999;
    display:block;
    }