DEV Community

loading...

Discussion on: Why CSS :focus-within is amazing

Collapse
nilsandrey profile image
Nils Andrey • Edited

Great tip. I just like to add some precision in terms. focus-within is a pseudo-class. There're pseudo-classes and pseudo-elements, the selector is the full "query" part of the CSS rule.

  • A CSS pseudo-class is a keyword added to a selector that specifies a special state of the selected element(s). For example, :hover can be used to change a button's color when the user's pointer hovers over it.
  • A CSS pseudo-element is a keyword added to a selector that lets you style a specific part of the selected element(s). For example, ::first-line can be used to change the font of the first line of a paragraph.

MDN: Pseudo-classes and pseudo-elements

Collapse
dailydevtips1 profile image
Chris Bongers Author

100% correct on the terminology here.
Thanks for the addition