CSS triangle custom border color

后端 未结 5 1004
情话喂你
情话喂你 2020-11-22 13:28

Attempting to use a custom hex color for my css triangle (border). However since it uses border properties I am unsure how to go about doing this. I would like to steer clea

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-22 13:37

    .triangle{
        position: absolute;
        width:0px;
        height:0px;
        border-left: 45px solid transparent;
        border-right: 45px solid transparent;
        border-bottom: 72px solid #DB5248;
    }
    
    .triangle:after{
        position: relative;
        content:"!";
        top:8px;
        left:-8px;
        color:#DB5248;
        font-size:40px;
    }
    
    .triangle:before{
        content:".";
        color: #DB5248;
        position: relative;
        top:-14px;
        left:-43px;
        border-left: 41px solid transparent;
        border-right: 41px solid transparent;
        border-bottom: 67px solid white;
    }
    

提交回复
热议问题