【发布时间】:2014-07-02 09:41:21
【问题描述】:
【问题讨论】:
-
将
::before和::after与基本的CSS 三角形一起使用。
标签: html css button shape css-shapes
【问题讨论】:
::before 和::after 与基本的CSS 三角形一起使用。
标签: html css button shape css-shapes
诀窍是使用伪类:before 和:after。试试这样:
.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/
【讨论】: