0

我正在尝试在自定义按钮上实现悬停发光(见下图)。我在 Chrome 中玩,无法使用 -webkit-radial-gradient 获得任何类似的外观。 在此处输入图像描述

<html>
  <head>
    <style type="text/css">
      button {
        margin-top: 20px;
        width: 100px;
        height: 32px;
        border-style: solid;
        border-width: 1px;
        border-radius: 5px 5px 5px 5px;
        border-color:#D95D00;
        box-shadow: 0 0 4px #F3BB35 inset;
        background: -webkit-gradient(linear, left bottom, left top, from(#D95D00), to(#E6A200));
        background: -webkit-gradient(linear, left top, left bottom, from(#FFD266), to(#F28430));
        background: -webkit-gradient(linear, left bottom left top, from(#E97F2F), to(#F3BB35));
      }
      button:hover {
        background: -webkit-gradient(linear, left bottom, left top, from(#D95D00), to(#E6A200));
        background: -webkit-gradient(linear, left top, left bottom, from(#FFD266), to(#F28430));
        background-image: -webkit-radial-gradient(center, ellipse cover, #FFFFFF, #000);
      }
    </style>
  </head>
  <body>
    <button>Hello</button>
  </body>
</html>
4

1 回答 1

0

它适用于线性渐变。径向渐变类似:dabblet

你必须给你的background-image(渐变)一个大小(以任何单位)。然后更改以下一个或多个属性:

background-size: // to change the glow radius
background-position: // to change the center of the glow, pretty much analogue to linear gradient
background-color: // for partly transparent gradients
于 2012-08-09T11:25:08.523 回答