这个好像很难用css做到, 不过或许可以考虑用svg做, 也可以用border-radius和背景颜色(多个元素嵌套排版)做, 不过做出的效果, 和这个区别有点大, 下面是一个例子
<!doctype html><html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style>
dl.xz{
background-color: #ff6000
overflow: hidden
margin: 0
padding: 0
}
dl.xz dt,dl.xz dd{
float:left
height: 40px
line-height: 40px
margin: 0
padding: 0
}
dl.xz dt{
background-color: #fff
overflow: hidden
}
dl.xz dt>span{
width:15px
float: left
height: 100%
display: block
background: #fff
}
dl.xz dt>span>span{
width:100%
height: 100%
display: block
background: #ff6000
border-top-left-radius: 15px
}
dl.xz dt>span.left{
width:60px
background-color: #ff6000
}
dl.xz dt>span.left>span{
background: #fff
border-bottom:2px solid #ff6000
border-bottom-right-radius: 30px
border-top-left-radius: 0
height: 38px
}
</style>
</head>
<dl class="xz">
<dt>
<span class="left"><span></span></span><span class="right"><span></span></span>
</dt>
<dd>测试按钮</dd>
</dl>
<body>
</body>
</html>
给这个元素添加样式{
border-top-left-radius: 数值px
border-top-right-radius:数值px
}
或者直接用背景图片
CSS linear-gradient() 函数用于创建一个表示两种或多种颜色线性渐变的图片。其结果属于<gradient>数据类型,是一种特别的<image>数据类型。linear-gradient( [ <angle>| to <side-or-corner>,]? <color-stop-list>)
\---------------------------------/ \----------------------------/
Definition of the gradient line List of color stops
where <side-or-corner>= [ left | right ] || [ top | bottom ]
and <color-stop-list>= [ <linear-color-stop>[, <color-hint>? ]? ]#, <linear-color-stop>
and <linear-color-stop>= <color>[ <color-stop-length>]?
and <color-stop-length>= [ <percentage>| <length>]{1,2}
and <color-hint>= [ <percentage>
栗子:
div {
background: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet)
}