Member-only story
My CSS Christmas Wishlist
We got spoiled in 2023 with new CSS features. From native nesting, :has()
support (Firefox support is coming Tuesday!!) , container queries and the super cool scroll-timeline
, 2023 is the year CSS exploded with possibilities.
But like any fat kid in the candy shop, I want more. More, I tell you!
So here is my CSS Christmas Wishlist:
1. XPath Selectors
I want CSS to have the ability to select elements via XPath instead of “regular” selectors. For example, I want both of these to style all the p
tags:
p { color: red; }
//p { color: red; } /*or maybe something like :xpath(//p) because that // might cause an issue*/
But why would I want that? 1) Because XPath is supported in PHP, JavaScript, Python and many other langues, but not CSS and 2) XPath has a built-in parent selector. We can do this: