turning an image into css

前端 未结 8 1888
一生所求
一生所求 2021-01-16 03:59

I have this image (attached). I am not a designer but I do not want to use the image in my app. I heard you can come very close to an image using css. Can someone help me wi

8条回答
  •  一个人的身影
    2021-01-16 04:48

    If you have

    , you could apply this style:

    .magic { 
        width: 200px; 
        height: 50px; 
    }
    .magic:before {
        content: '.';
        float: left;
        width: 0;
        height: 0;
        border-top: 25px solid transparent;
        border-left: 25px solid white;
        border-bottom: 25px solid transparent;
    }
    

    ​Change dimensions to your own taste. This trick is called CSS Triangle.

    jsFiddle Demo

    EDIT: Or a quick demo with a transparent arrow - here you basically use different border colors for the tricky borders and a way to move the arrow to the left - I used position: relative - so the div's background won't cover what is underneath.

提交回复
热议问题