turning an image into css

前端 未结 8 1795
一生所求
一生所求 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:49

    Here's an example to get you started:

    HTML:

    CSS:

    .box {
        /* Set dimensions and color of containing box */
        width: 100px;
        height: 30px;
        background: #03e;
    }
    
    .flag {
        float: left;
        /* Set left border to control width and color of flag */
        border-left: 20px solid #fff;
        /* Set top and bottom border each to half of box height */
        border-top: 15px solid transparent;
        border-bottom: 15px solid transparent;
        width: 0;
        height: 0;
    }​
    

    Fiddle link: http://jsfiddle.net/kHDFp/

提交回复
热议问题