使用框阴影制作斜角效果

时间:2013-06-07 01:21:52

标签: html css3 bevelled

我有这个css代码,上面有一个标签。当我将鼠标悬停在它上面时,我把它称为斜角。

这是css:

#slider-next {    
    padding:10px 60px;
    -webkit-border-radius: 25px;
  -moz-border-radius: 25px;
border-radius: 25px;
    background: -moz-linear-gradient(top, #28c4e3 0%, #0d5664 100%); /* firefox */

    text-shadow: 0 1px 2px #fff;
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#28c4e3), color-stop(100%,#0d5664)); /* webkit */font-size:20px}

#slider-next:hover {
    box-shadow:         0 1px 2px #fff, 0 -1px 1px #666, inset 0 -1px 1px rgba(0,0,0,0.5), inset 0 1px 1px rgba(255,255,255,0.8);
    -moz-box-shadow:    0 1px 2px #fff, 0 -1px 1px #666, inset 0 -1px 1px rgba(0,0,0,0.5), inset 0 1px 1px rgba(255,255,255,0.8);
    -webkit-box-shadow: 0 1px 2px #fff, 0 -1px 1px #666, inset 0 -1px 1px rgba(0,0,0,0.5), inset 0 1px 1px rgba(255,255,255,0.8);
     border: solid #ccc 3px;
}

这是html:

<span id="slider-next" style="float:right"></span>

我想要做的是当我将鼠标悬停在跨栏文本上时,它会斜上去,给出一个效果按钮。现在它向下倾斜。

如何让它弯曲? Here's a fiddle of it.

1 个答案:

答案 0 :(得分:0)

只需要对box-shadow值进行快速调整(我将y值反转),现在它看起来更像是一个按钮。此外,您的前缀box-shadow声明应始终位于未加前缀的声明之前。

现场演示:

&#13;
&#13;
#slider-next {    
    padding:10px 60px;
    -webkit-border-radius: 25px;
  -moz-border-radius: 25px;
border-radius: 25px;
    background: -moz-linear-gradient(top, #28c4e3 0%, #0d5664 100%); /* firefox */

    text-shadow: 0 1px 2px #fff;
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#28c4e3), color-stop(100%,#0d5664)); /* webkit */font-size:20px}

#slider-next:hover {
    -moz-box-shadow:    0 -1px 2px #fff, 0 1px 1px #666, inset 0 -1px 1px rgba(0,0,0,0.5), inset 0 -1px 1px rgba(255,255,255,0.8);
    -webkit-box-shadow: 0 -1px 2px #fff, 0 1px 1px #666, inset 0 -1px 1px rgba(0,0,0,0.5), inset 0 -1px 1px rgba(255,255,255,0.8);
    box-shadow:         0 -1px 2px #fff, 0 1px 1px #666, inset 0 -1px 1px rgba(0,0,0,0.5), inset 0 -1px 1px rgba(255,255,255,0.8);
    border: solid #ccc 3px;
}
&#13;
<span id="slider-next" style="float:left"></span>
&#13;
&#13;
&#13;

JSFiddle版本:http://jsfiddle.net/g7YMV/4/