无图像纯CSS箭头标签

时间:2012-04-15 09:55:38

标签: css css3

有没有办法在不使用图像的情况下创建类似美味的“箭头标签”: Delicious tags

我熟悉border-triangle technique,但无法让它看起来不错(部分原因是我们需要一个额外的外边框来构建整个组件)。

1 个答案:

答案 0 :(得分:8)

我创建了一个小例子可能就是你想要的。

<强> 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

http://jsfiddle.net/9EEEP/77/

有关详情,请查看我的答案How to code certain css shapes?

我使用的css3在浏览器下面的IE8中不起作用。