How to put text on a CSS Triangle

前端 未结 2 1870
再見小時候
再見小時候 2021-01-07 01:59

I must be missing a simple step. I have made a triangle in CSS and I\'m trying to put text on top of the triangle. It works if I don\'t have the width:0; and

2条回答
  •  醉酒成梦
    2021-01-07 02:26

    Try out this

    .up {
        width: 0px;
        height: 0px;
        border-style: inset;
        border-width: 0 100px 173.2px 100px;
        border-color: transparent transparent blue transparent;
        float: left;
        transform:rotate(180deg);
        display:block
    }
    
    .up span {
        text-align: center;
        left: -47px;
        top:25px;
        position: relative;
        width: 93px;
        height: 93px;
        margin: 0px;
        transform:rotate(180deg);
        display:block;
    }
    
        TEXT TEXT TEXT
    

提交回复
热议问题