如何通过 css3 创建像图片一样的按钮?
我试过下面的代码。
<style type="text/css">
.left,
.right{
float:left;
border-style:solid;
width:0px;
height:0px;
}
.left{
border-color: red green red green;
border-width:15px 0px 15px 75px;
}
.right{
border-color: green green green red;
border-width:15px 20px 15px 35px;
}
</style>
<div>
<div class="left"></div>
<div class="right"></div>
</div>
但得到了这样的输出:
创建按钮的弯曲边框和两个按钮之间的细曲线的确切方法是什么?
-谢谢。
编辑:根据你的回答,我做了这个:
<style type="text/css">
.left,
.middle,
.right{
height:30px;
display:block;
float:left;
text-decoration:none;
position: relative;
text-align:center;
color:black;
}
.left,
.right{
padding:0px 10px;
line-height: 30px;
}
.left{
background-color:red;
width:60px;
border-bottom-left-radius: 17px;
border-top-left-radius: 17px;
}
.middle{
background-color:#ddd;
width:2px;
}
.right{
background-color:green;
width:40px;
border-bottom-right-radius: 17px;
border-top-right-radius: 17px;
}
.middle::before{
content: "";
position: absolute;
top: 5px;
margin-top: -5px;
border-width: 15px;
border-style: solid;
border-color: #ddd transparent #ddd transparent;
left: -15px;
}
.right::before{
content: "";
position: absolute;
top: 5px;
margin-top: -5px;
border-width: 15px;
border-style: solid;
border-color: green transparent green transparent;
left: -15px;
}
.left:hover{
background-color:blue;
}
.right:hover{
background-color:orange;
}
.right:hover::before{
border-color: orange transparent orange transparent;
}
</style>
<a href="javascript:void();" class="left">play</a>
<a href="javascript:void();" class="middle"></a>
<a href="javascript:void();" class="right">pause</a>
输出:
标准网站可以吗?