纯css实现不同方向的三角形

.triangle {
    position: relative;
    &:after {
        position: absolute;
        top: 50%;
        transform: translate(0,-50%);
        right: 0;
        content: '';
        display: block;
        width: 0;
        height: 0;
        background: transparent;
        border: 10px solid transparent;
        border-top-color: transparent;
        border-bottom-color: transparent;
        border-left-color: transparent;
        border-right-color: #0f0;
    }
}

猜你喜欢

转载自www.cnblogs.com/stella1024/p/10550885.html