Skip to main content

Which pseudo-elements do you know?

The main and commonly used pseudo-elements in CSS:

1) For content and styling ::before - adds content before the element ::after - adds content after the element

2) For text ::first-line - styles the first line of text ::first-letter - styles the first letter ::selection - styles the text the user has selected

3) For forms and input ::placeholder - styles the placeholder text in an input/textarea ::file-selector-button - styles the button of an input type="file"

4) Markup and utility ::marker - styles list markers (li) ::backdrop - the background behind modal elements (for example a dialog in fullscreen) ::cue - styles for video subtitles (WebVTT)

These are the main and most frequently used pseudo-elements in practice.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.