How can I inspect and tweak :before and :after pseudo-elements in-browser?

后端 未结 7 2114
被撕碎了的回忆
被撕碎了的回忆 2020-12-04 23:13

I have created some fairly elaborate DOM elements with an :after pseudo-element, and I\'d like to be able to inspect and tweak them in either Chrome Inspector or Firebug or

7条回答
  •  被撕碎了的回忆
    2020-12-04 23:28

    Chrome won't show :before and :after pseudo elements in the DOM-tree, if they miss "content" attribute. It should be set, even if it is set to nothing.

    This won't show up:

    :after {
      background-color: red;
    }
    

    This will show up in the inspector:

    :after {
      content: "";   
      background-color: red;    
    }
    

    Hope it helps.

提交回复
热议问题