Why Doesn\'t ::after Work on Elements?

Mary-Kate Olsen
Release: 2024-10-25 13:34:02
Original
387 people have browsed it

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!