:matches

What’s New In CSS?

Rachel hooks us up with what the CSS Working Group is talking about:

  • Styling scrollbars. This would come with properties like scrollbar-width and scrollbar-color. The best we have right now is proprietary WebKit stuff.
  • Aspect ratios. I imagine the CSS portion of this journey will be best handled if it plays nicely with the HTML intrinsicsize stuff.
  • Matching without specificity. :where() is :matches() with no specificity, and :matches() may become :is().
  • Logical Properties shorthand. The team is discussing a shorthand syntax for Logical Properties and the possibility logical would be default over the current physical with a defined "mode" in the stylesheet.

:any-link

The :any-link pseudo-class in CSS provides a method for selecting elements that are the source anchor of a hyperlink.

If the term source anchor lost you, that's a fancy name for the href attribute on the HTML elements <a></a>, <link /> and <area />. (Why you would need to target an <area /> or <link /> in CSS is beyond me, but hey.) The HTML spec has a whole lot more information on that.

An element that accepts and contains a href attribute is a hyperlink and will be selected with :any-link. This becomes a handy way of selecting all link-based HTML elements that might otherwise appear unrelated and without touching the markup. Perhaps it exists because you might think :link would select all links, but it misses :visited, so this wraps them all up together.

Functionally, it's just like the attribute selector [href].

(more…)

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag