There are a number of new selector types being specified for CSS Selectors Level 4 (the latest version available was the Editor's Draft dated December 14, 2014, (http://dev.w3.org/csswg/selectors-4/). However, as I write this, there are no implementations of them in browsers. As such we will just look at one example as they are liable/probable to change.
The Relational Pseudo-class selector is from the 'Logical Combinations' (http://dev.w3.org/csswg/selectors-4/) section of the latest draft.
This selector takes this format:
a:has(figcaption) {
padding: 1rem;
}This would add padding to any item a tag that contains a figcaption. You could invert the selection in combination with the negation pseudo class too:
a:not(:has(figcaption)) {
padding: 1rem;
}This would add the padding if the a tag did not contain a figcaption element.
I'll be honest and say that right now, there aren't many new selectors in that draft that get me excited. But who knows what they'll come up with by the time they start being available to use in browsers?
Let's change tack now. We've looked at how we can select items in our responsive world. But how about how we size them? The CSS Values and Units Module Level 3 (http://www.w3.org/TR/css3-values/), ushered in viewport relative units. These are great for responsive web design as each unit is a percentage length of the viewport:
Browser support isn't bad either (http://caniuse.com/).
Want a modal window that's 90% of the browser height? It's as easy as:
.modal {
height: 90vh;
}However, you can perhaps find more utility for these units when coupled with fonts. For example, it's now trivially easy to create text that scales in size depending upon the viewport.
Now, I could show you that right now. However, I'd like to use a distinct font, so that regardless of whether you are viewing the example on a Windows, Mac, or Linux box we will all see the same thing.
OK, I'll be honest, this is a cheap ploy to allow me to document how we can use web fonts with CSS3.