CSS: How to remove pseudo elements (after, before,…)?

后端 未结 8 1989
独厮守ぢ
独厮守ぢ 2020-12-22 17:44

I would like to use a switch for the layout of paragraph tags on a webpage.

I use the after pseudoelement:

p:after {content: url(\"../img/paragraph.g         


        
相关标签:
8条回答
  • 2020-12-22 18:28

    As mentioned in Gillian's answer, assigning none to content solves the problem:

    p::after {
       content: none;
    }
    

    Note that in CSS3, W3C recommended to use two colons (::) for pseudo-elements like ::before or ::after.

    From the MDN web doc on Pseudo-elements:

    Note: As a rule, double colons (::) should be used instead of a single colon (:). This distinguishes pseudo-classes from pseudo-elements. However, since this distinction was not present in older versions of the W3C spec, most browsers support both syntaxes for the sake of compatibility. Note that ::selection must always start with double colons (::).

    0 讨论(0)
  • 2020-12-22 18:33
    p:after {
      content: none;
    }
    

    This is a way to remove the :after and you can do the same for :before

    0 讨论(0)
提交回复
热议问题