How CSS level 4 selectors could boost devs' powers

Times are changing. CSS is becoming a kind of Swiss Army knife for the web. We can already use a range of helpful selectors such as :nth-child, :nth-of-type and :not() to target specific DOM elements. With CSS level 4 selectors, there will be an extra layer of power.

Firstly, there's the :matches pseudo-­class. We can use it to match an element against a list of selectors. For example, if we want to apply the same link colour to the different states of an anchor, we can simply do:

Thank you for reading 5 articles this month* Join now for unlimited access

Enjoy your first month for just £1 / $1 / €1

*Read 5 free articles per month without a subscription

Join now for unlimited access

Try first month for just £1 / $1 / €1

TOPICS
All things Creative Bloq

The Creative Bloq team is made up of a group of design fans, and has changed and evolved since Creative Bloq began back in 2012. The current website team consists of eight full-time members of staff: Editor Georgia Coggan, Deputy Editor Rosie Hilder, Ecommerce Editor Beren Neale, Senior News Editor Daniel Piper, Editor, Digital Art and 3D Ian Dean, Tech Reviews Editor Erlingur Einarsson, Ecommerce Writer Beth Nicholls and Staff Writer Natalie Fear, as well as a roster of freelancers from around the world. The ImagineFX magazine team also pitch in, ensuring that content from leading digital art publication ImagineFX is represented on Creative Bloq.