Add a space (“ ”) after an element using :after

后端 未结 5 2002
遥遥无期
遥遥无期 2020-12-12 09:41

I want to add a blank space after some content, however the content: \" \"; doesn\'t seem to work.

This is my code:

h2:after {
    conte         


        
5条回答
  •  北海茫月
    2020-12-12 10:07

    There can be a problem with "\00a0" in pseudo-elements because it takes the text-decoration of its defining element, so that, for example, if the defining element is underlined, then the white space of the pseudo-element is also underlined.

    The easiest way to deal with this is to define the opacity of the pseudo-element to be zero, eg:

    element:before{
      content: "_";
      opacity: 0;
    }
    

提交回复
热议问题