2013-03-05 23 views
1

我想创建一个三角形点击按钮像div,在附加的图像是我想实际实现的。 image如何创建三角形可点击的div?

这是我到目前为止已经达到了,JsFiddle

HTML:

<div class="input"><</div> 

CSS:

body {padding:40px;} 

.input { 
text-decoration:none; 
padding:5px 10px;  
background:#117ebb; 
font-size:9px; 
color:#fff; 
border-radius:5.5px 0px 0px 5px; 
box-shadow: 0px 5px 3px #003355; 
position:relative; 
width:1px; 
height:12px; 
} 

.input:after { 
position:absolute; 
top:0px; 
left:-10px; 
content:" "; 
width: 0; 
height: 0px; 
border-top: 13px solid transparent; 
border-bottom: 13px solid transparent; 
border-right:13px solid #117ebb; 
border-radius:0px 0px 0px 20px; 
} 
+1

究竟什么是你的问题?你可以包装'<' with ''并使其可点击。 – brbcoding 2013-03-05 18:27:09

回答

0

CSS纯三角和使用jQuery您可以添加点击事件:

html

<div class="input"></div> 

jQuery的

$(document).ready(function(){ 
    $(".input").click(function(){ 
     alert('hello arrow');   
    }); 
}); 

CSS

body {padding:40px;} 
.input{ 
    width: 0; 
    height: 0; 
    border-top: 10px solid transparent; 
    border-bottom: 10px solid transparent; 

    border-right:10px solid blue; 
    cursor: pointer; 
} 

http://jsfiddle.net/TvJ6t/

+1

最新...这是我想要做的,http://jsfiddle.net/dajin007/nA6yn/1/ – 2013-03-06 00:02:16

+0

整个矩形区域(包括不可见部分)是可点击的,而不仅仅是实际的三角形。 – 2014-07-24 21:09:42