有没有一种方法可以在不使用图像的情况下创建类似 Delicious 的“箭头标签”:
我熟悉 border-triangle technique , 但无法让它看起来像样(部分原因是我们需要一个额外的外边框来构建整个组件)。
最佳答案
我创建了一个小示例,可能就是您想要的。
CSS
div{
padding:5px 10px;
font-size:12px;
-moz-border-radius:0 5px 5px 0;
-webkit-border-radius:0 5px 5px 0;
float:left;
margin-left:30px;
margin-top:20px;
position:relative;
font-family:verdana;
color:#3b3d3c;
border:1px solid #d5d5d7;
border-left:0;
}
div{
background: -moz-linear-gradient( top , #fbfdfc 0%,#f6f5f5 100%);
background: -webkit-linear-gradient( top , #fbfdfc 0%,#f6f5f5 100%);
}
div:after{
content:"";
width:18px;
height:18px;
background: -moz-linear-gradient( left top , #fbfdfc 0%,#f6f5f5 100%);
background: -webkit-linear-gradient( left top , #fbfdfc 0%,#f6f5f5 100%);
-moz-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
display:block;
position:absolute;
top:3px;
left:-10px;
z-index:-1;
border:1px solid #d5d5d7;
}
检查这个http://jsfiddle.net/9EEEP/76/
已更新 现在也可以在 chrome 中工作了
有关更多信息,您还可以查看我的这个答案 How to code certain css shapes?
我使用的 css3 在 IE8 以下浏览器中不起作用。
关于css - 无图像纯 CSS 箭头标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10161028/