2013-10-09 78 views

回答

1

我找到了一个解决方案,请注意,这只是一个纯色背景的作品。

HTML:

<div class="arrow"> 
    START HERE! 
</div> 

CSS:

body { 
    background: #6cc5c3; 
} 
.arrow { 
    margin-top: 150px; 
    position: relative; 
    font-weight: bold; 
    margin-bottom: 5px; 
    height: 20px; 
    padding: 10px 30px 10px 10px; 
    width: 140px; 
    color: #6cc5c3; 
    background: #fff; 
    text-align: center; 
} 
.arrow:after { 
    content:''; 
    height: 0; 
    width: 0; 
    display: block; 
    border-color: #6cc5c3 #6cc5c3 #6cc5c3 transparent; 
    border-width: 20px; 
    border-style: solid; 
    position: absolute; 
    top: 0; 
    right: -20px; 
} 

.gradient { 
    background: #ffe632; 
    background: -webkit-gradient(linear, left top, left bottom, from(#fffe8d), to(#f6d23e)); 
    background: -moz-linear-gradient(top, #fffe8d, #f6d23e); 
} 

DEMO

的箭头是透明的,而 “箭头” 的其余部分是相同的身体背景颜色。

+0

其实它很好用,我看到渐变,一个问题,为什么当鼠标离开按钮时,他是钢色的? – alonblack

+1

因为您通过这种方式编写了脚本... :)使用addClass jQuery函数。如果您不希望只能使用CSS,请将'.gradient'更改为'.arrow:hover'。检查http://jsfiddle.net/LinkinTED/VNnKR/10/ – LinkinTED

+0

干杯队友,真的很有帮助感谢您的时间! – alonblack