純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;
    }
}

相關文章
相關標籤/搜索