css background image positioning (negative position?)

后端 未结 4 1757
花落未央
花落未央 2020-12-17 01:13

I\'m trying to add an icon which sits on top of the border, splitting it in half.

Here is what I have so far:



    

        
4条回答
  •  一向
    一向 (楼主)
    2020-12-17 01:50

    Another way is using the pseudo class :after to inject an element after your box.

    CSS

      .box{
        position:relative;
      }
      .box:after{
           content:url(icon_neutral.png);
           display:block;
           position:relative;
           top: -30px;
      }
    

    HTML

    
        

    This is a test!

提交回复
热议问题