How to make rectangle with pointed sides?
This question already has an answer here:
The trick is to use the pseudo classes :before
and :after
. Try it like this:
.yourButton {
position: relative;
width:200px;
height:40px;
margin-left:40px;
color:#FFFFFF;
background-color:blue;
text-align:center;
line-height:40px;
}
.yourButton:before {
content:"";
position: absolute;
right: 100%;
top:0px;
width:0px;
height:0px;
border-top:20px solid transparent;
border-right:40px solid blue;
border-bottom:20px solid transparent;
}
.yourButton:after {
content:"";
position: absolute;
left: 100%;
top:0px;
width:0px;
height:0px;
border-top:20px solid transparent;
border-left:40px solid blue;
border-bottom:20px solid transparent;
}
JsFiddle: http://jsfiddle.net/VpW5x/
链接地址: http://www.djcxy.com/p/89480.html下一篇: 如何制作带有尖角的矩形?