首页 > 技术文章 > css实现小箭头样式

longtengfly 2018-07-19 19:25 原文

<div class="arrow"></div>

  

.arrow{
    position: absolute;
    display: block;
    left: -13px;
    top: 12px;
    margin-right: 3px;
    width: 0;
    height: 0;
    border-color: transparent;
    border-style: solid;
    border-width: 12px;
    border-left-width: 0;
    border-right-color: #e5e5e5;
    -webkit-filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
    filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
}
.arrow:after{
    content: " ";
    border-width: 12px;
    position: absolute;
    display: block;
    width: 0;
    height: 0;
    border-color: transparent;
    border-style: solid;
    top: -12px;
    margin-left: 1px;
    border-left-width: 0;
    border-right-color: #fff;
}

  arrow元素的父元素的overflow属性必须为visible

推荐阅读