Why do the :before and :after pseudo-elements require a ‘content’ property?

Here are some references to various W3C specifications and drafts: Selectors Level 3 The :before and :after pseudo-elements can be used to insert generated content before or after an element’s content. The :before and :after pseudo-elements Authors specify the style and location of generated content with the :before and :after pseudo-elements. As their names indicate, … Read more

Can I use a :before or :after pseudo-element on an input field?

:before and :after render inside a container and <input> can not contain other elements. Pseudo-elements can only be defined (or better said are only supported) on container elements. Because the way they are rendered is within the container itself as a child element. input can not contain other elements hence they’re not supported. A button … Read more