css实现三角形相关

1.css样式面包屑导航条实现矩形和三角箭头拼接
.cssTest {
    font-family: PingFangSC-Regular;
    font-size: 16px;
    color: #333333;
    line-height: 40px;
    /* 左侧部分 */
    .cssTest1 {
        width: 750px;
        height: 40px;
        background-color: #D3D8DF;
        position: relative;
        display: inline-block;
    }
    .cssTest1:after {
        content: '';
        width: 0px;
        height: 0px;
        border-top: 20px solid rgba(255, 255, 255, 0);
        border-right: 20px solid rgba(255, 255, 255, 0);
        border-bottom: 20px solid rgba(255, 255, 255, 0);
        border-left: 20px solid #D3D8DF;
        left: 750px;
        position: absolute;
        z-index: 99;
    }
    .cssTest2 {
        width: 750px;
        height: 40px;
        background-color: #87AAD2;
        position: relative;
        display: inline-block;
        left: 50px;
    }
    .cssTest2:before {
        content: '';
        width: 0px;
        height: 0px;
        border-top: 20px solid #87AAD2;
        ;
        border-right: 20px solid #87AAD2;
        ;
        border-bottom: 20px solid #87AAD2;
        ;
        border-left: 20px solid rgba(255, 255, 255, 0);
        position: absolute;
        right: 750px;
    }
}

2.画三角形的右上部分
<div class="example-content-image-status status-mutual"></div>
.example-content-image-status {
    z-index: 2;
    width: 0;
    height: 0;
    position: absolute;
    border-bottom: 1.875rem solid rgba(255, 255, 255, 0);
    border-left: 3.125rem solid rgba(255, 255, 255, 0);
    border-top: 1.875rem solid rgba(255, 255, 255, 0);
    border-right: 3.125rem solid rgba(255, 255, 255, 0);
    right: 0;
}
.status-mutual {
    border-top: 1.875rem solid #919191;
    border-right: 3.125rem solid #919191;
}

猜你喜欢

转载自www.cnblogs.com/lskzj/p/10638472.html