其他分享
首页 > 其他分享> > CSS三角

CSS三角

作者:互联网

CSS三角

.box1 {
            width: 0;
            height: 0;
            /* border: 10px solid pink; */
            border-top: 10px solid pink;
            border-right: 10px solid red;
            border-bottom: 10px solid blue;
            border-left: 10px solid green;
        }

.box2 {
            width: 0;
            height: 0;
            border: 50px solid transparent;
            border-left-color: pink;
            margin: 100px auto;
        }

       .jd {
            position: relative;
            width: 120px;
            height: 249px;
            background-color: pink;
        }
        .jd span {
            position: absolute;
            right: 15px;
            top: -10px;
            width: 0;
            height: 0;
            /* 为了照顾兼容性 */
            line-height: 0;  
            font-size: 0;
            border: 5px solid transparent;
            border-bottom-color: pink;
        }

CSS三角强化

*{
    margin: 0;
    padding: 0;
}
.box{   
    width: 0;
    height: 0;
    border: 100px solid transparent;
    border-bottom-color: blue;
}
.box1{
    float: left;
    border-top: 200px solid transparent;
    border-right: 100px solid blue;
    border-bottom: 0 solid transparent;
    border-left: 0 solid transparent;
}

*{
    margin: 0;
    padding: 0;
}
.box{   
    width: 0;
    height: 0;
    border: 100px solid transparent;
    border-bottom-color: green;
}
.box1{
    float: left;
    border-top: 200px solid transparent;
    border-right: 50px solid brown;
    border-bottom: 0 solid transparent;
    border-left: 0 solid transparent;
    margin-left: 50px;
}
.box2{
    float: left;
    border-top: 200px solid transparent;
    border-right: 0 solid transparent;
    border-bottom: 0 solid transparent;
    border-left: 50px solid brown;
   
}

或者

*{
    margin: 0;
    padding: 0;
}
.box{
    width: 0;
    height: 0;
    border: 100px solid transparent;
    border-bottom-color: green;
}
.box1{
    float: left;
    border-color: transparent brown transparent transparent;
    border-style: solid;
    border-width: 200px 50px 0 0;
    margin-left: 50px;
}
.box2{
    float: left;
    border-color: transparent transparent transparent brown;
    border-style: solid;
    border-width: 200px 0 0 50px;  
}

标签:solid,三角,width,color,border,transparent,CSS,left
来源: https://www.cnblogs.com/Cookie-Jing/p/15874153.html