Does :before not work on img elements?

后端 未结 12 2241
眼角桃花
眼角桃花 2020-11-22 01:46

I\'m trying to use the :before selector to place an image over another image, but I\'m finding that it simply doesn\'t work to place an image before an im

12条回答
  •  情歌与酒
    2020-11-22 02:14

    I tried and found a simpler method to do so. Here is the HTML:

        
        

    What I did was place an empty

    tag after my image tag. Now I will use p::before to show the image and position it according to my needs. Here is the CSS:

    #empty_para
    {
        display:inline;
        font-size:40;
        background:orange;
        border:2px solid red;
        position:relative;
        top:-400px;
        left:100px;
    }
    #empty_para::before
    {
        content: url('messages.png');
    }
    

    Try it.

提交回复
热议问题