Creating a transparent arrow above image in CSS3

前端 未结 2 560
死守一世寂寞
死守一世寂寞 2020-12-06 12:47

I\'m trying to create an effect where I have a transparent arrow above any image in CSS3. See the following image.

2条回答
  •  时光取名叫无心
    2020-12-06 13:07

    I think you need something like this:

    .arrow {
        bottom: -25px; 
        left: 30px; 
        width: 40px;
        height: 40px;
        position: absolute;
        overflow: hidden;
    }
    
    .arrow:after {
        content: ' ';
        display: block;
        background: red;
        width: 20px;
        height: 20px;
        transform: rotate(45deg);
        position: absolute;
        top: -19px;
        left: 3px;
        background: #999;
        border: 5px solid rgba(0, 0, 0, 0.2);
        background-clip: padding-box;
    }
    

提交回复
热议问题