Over a million developers have joined DZone.

CSS4 is coming already

· Web Dev Zone

Make the transition to Node.js if you are a Java, PHP, Rails or .NET developer with these resources to help jumpstart your Node.js knowledge plus pick up some development tips.  Brought to you in partnership with IBM.

CSS4 is on the way. That might sound odd, since CSS3 isn't complete, but W3C doesn't work whole-cloth anymore: after CSS 2.1, they decided to publish later specs one part at a time. So as CSS3 gains new recommendations, CSS4 receives its first.

So far the changes definitely seem to (a) respond to developer demand and (b) offer the developer more control.

Scott Gilbertson at Webmonkey describes the most-requested new feature: the subject selector (current indicator: '$'), which lets you specify more precisely when to apply formatting rules:

CSS 4 includes a means of controlling which element in the selection chain is actually being styled. The easiest way to understand the “subject” selector is by example. Say you want to style a list (ul), but only when the user has clicked on an item in the list. You add a class “clicked” to the item (ul li.clicked) when the user clicks on it, but how do you style the whole list from that class?

With the subject selector it’s simple:

1$ul li.clicked {
2    background: white;

The “$” means that the rule is applied to the ul, rather than the li.clicked as it normally would.

Other highlights include pseudo-classes like matches, simplifying nested CSS, and domain-specific link formatting (local-link).

Read Scott's whole post for a fuller overview of what's new in CSS4.

Finally, for a more complete discussion (way less turgid than the spec), try David Storey's blog post on CSS4 selectors. David is a W3G Working Group member, so you know he knows what he's talking about. And his post really does cover the most important stuff in the full W3C draft.

Learn why developers are gravitating towards Node and its ability to retain and leverage the skills of JavaScript developers and the ability to deliver projects faster than other languages can.  Brought to you in partnership with IBM.


Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}