What's new in CSS Selectors 4
grack.com
grack.com
This opens up a great deal of new ways to match
content. For instance, a developer can match all
paragraphs that contain nothing but images:
// Match a paragraph that does not have anything that is not an image
p:not(:has(:not(img))):not(:empty)
You don't start introducing :has with a convoluted multi-negative example like that. You save that for after the reader understands what :has does, to demonstrate how it lets you do really complex expressions that you couldn't do before. Or maybe you don't bother with that at all, since it's probably a rare case, and the much more common case that you should emphasize is that :has lets you style an element based on the children it contains, which CSS doesn't let you do today.And what does this mean?
Caveat: at this time the :has selector is not considered fast, which means that it may not be available for use in stylesheets.
Where else is a CSS selector useful? In particular, where else is the most interesting part of CSS Selectors 4 going to be useful? Don't tell me Javascript code, because I can already do this stuff in Javascript code, and more, without having to worry about browser support for a new CSS standard.The distinction between "fast" and "complete" selectors is explained in the spec doc: http://dev.w3.org/csswg/selectors-4/
Obviously I can't read the minds of the spec writers, but I imagine they don't know what the performance implications of :has() is right now and they don't want to commit to something that kills browser performance once it's out there in the wild.
(I don't necessarily mean "a vendor-specific implementation in a released browser" - but someone should be coding prototypes of this stuff. Adobe did it for some of their new additions - clearly marked as experimental in special builds of Chromium)
I think that :has syntax is pretty horrific... the '!' syntax was much simpler to read, but I see the reasoning behind making it function-like as the subject of the selector then remains looking like it did before.
We are using nth-selector to style icon for nav items, which IMO is a wrong way of styling nav items.
There are some good CSS <del>selector</del> properties like position sticky but not available in most browsers :(
@element '.sidebar' and (max-children: 5) {
.widget h3 {
font-size: 125%;
}
}
Check out the min-children/max-children examples on: http://elementqueries.com/test.htmlposition:sticky isn't a selector.
<selector> {<property>: <value>}Nor are there any useful distinctions between "browsers" and "the web".
What I suggest is that CSS 4 have the necessary functionality to specify styling of tooltips. It's not that bizarre of an idea. You could set the font, for instance, or colors, or borders. Likely once it becomes a psuedo-element, you could do even fancier things with it.
It's a no-brainer.