Note. This specification does not fully define the interaction of
::before
and::after
with replaced elements (such as IMG in HTML). This will be defined in more detail in a future specification.
I guess this means they don’t work with img
elements (for now).
Also see this answer.
More Related Contents:
- Why do the :before and :after pseudo-elements require a ‘content’ property?
- Can I have multiple :before pseudo-elements for the same element?
- CSS Pseudo Element Counters: can you increment an alphabet letter “a”, “b”, “c”, etc instead of a number?
- Can you apply a width to a :before/:after pseudo-element (content:url(image))?
- Purpose of *:before, *:after rule without content property
- Can I use a :before or :after pseudo-element on an input field?
- Why isn’t it possible to combine vendor-specific pseudo-elements/classes into one rule set?
- Is it possible to set the stacking order of pseudo-elements below their parent element? [duplicate]
- How can I write a ‘:hover’ condition for ‘a:before’ and ‘a:after’?
- CSS :after not adding content to certain elements
- Font Awesome 5 Choosing the correct font-family in pseudo-elements
- Can I change the height of an image in CSS :before/:after pseudo-elements?
- CSS :before on inline SVG
- Is there a way to use SVG as content in a pseudo element ::before or ::after
- Can I target a :before or :after pseudo-element with a sibling combinator?
- Should I use single or double colon notation for pseudo-elements?
- How can I make generated content selectable?
- Add line break to ::after or ::before pseudo-element content
- Universal selector * and pseudo elements
- Combine :after with :hover
- Z-index with before pseudo-element
- Are CSS3 ::before and ::after pseudo elements supported by IE9 or not?
- Vertically centering content of :before/:after pseudo-elements
- CSS data attribute new line character & pseudo-element content value
- “text-decoration” and the “:after” pseudo-element, revisited
- css rotate a pseudo :after or :before content:”” [duplicate]
- Should I use single colons (:) or double colons (::) for before, after, first-letter and first-line pseudo-elements?
- prevent a pseudo element from triggering hover?
- Apply webkit scrollbar style to specified element
- CSS3 transitions on pseudo-elements (:after, :before) not working?