Home >Web Front-end >CSS Tutorial >Why Doesn\'t ::after Work on Elements?
Mystery of the Vanished ::after
In the realm of CSS pseudo-elements, the ::after property is a powerful tool for injecting additional content into the DOM. However, it has been discovered that browsers curiously refuse to honor ::after on elements.
This seemingly inexplicable behavior has left web developers scratching their heads. According to the CSS21 Specification at http://www.w3.org/TR/CSS21/generate.html, ::after is designed to operate on elements with (document tree) content.
A closer examination reveals that lacks any such document tree content, just like and
. Consequently, browsers adhere to the specification by not displaying ::after for input fields. This explains the disappearance of the intended content in the provided code sample.
The above is the detailed content of Why Doesn't ::after Work on Elements?. For more information, please follow other related articles on the PHP Chinese website!