A Blog Not Limited

to web design, standards & semantics

CSS Selectors & Preferred “Styles”

Feb 20, 2012

Published in

Web Standards Sherpa

As I mentioned last summer, I'm honored to be a contributing writer Sherpa for Web Standards Sherpa. The site focuses on best practices and web standards, offering reviews of reader-submitted sites and applications.

My latest piece, What's Your CSS Style? is now available for your reading pleasure! In it, I review the reader-submitted klvn.org and discuss different selectors the author could use instead of (or in addition to) id and class selectors.

Selecting Selectors

The site I reviewed for What's Your CSS Style? featured what, I believe, is very common in our field: a ton of id selectors and a smattering of class selectors. This is certainly how I've written my CSS for most of my career. As I've encountered different types of projects and learned more about specificity, though, I'm starting to use other types of selectors.

Attribute selectors are my favorite these days, but I also encounter situations where sibling and child selectors are immensely helpful. Each — along with element, id and class selectors — have their own strengths and weaknesses. The key is understanding the options. Knowing different approaches to writing my CSS has made me a better developer simply because I have more knowledge to meet the need of different projects.

If you've always relied on a particular CSS selector, check out What's Your CSS Style? You might discover different selectors that could prove useful for your next project. Remember, knowledge is power!

HTML5 Cookbook

Interested in HTML5?
Get the Cookbook!

I was a contributing author for HTML5 Cookbook, available for sale on Amazon! Get yours now! (I hear chapters 1, 4 and 5 are particularly good.)

P.S. Don't forget my book Microformats Made Simple is still for sale!


Share the Love

Commenting is not available in this channel entry.

The Coolest Person I Know

Emily Lewis

Yeah, that would be me: .

I'm a freelance web designer of the standardista variety, which means I get excited about things like valid POSH, microformats and accessibility. I ply my trade from my one-person design studio in Albuquerque, New Mexico 87106 USA.

A Blog Not Limited is my personal blog where I pontificate about web design, web standards, semantics and whatever else strikes my fancy. Head on over to Emily Lewis Design if you'd like to see my work or, even better, hire me.


I Tweet, Therefore I Am

Follow @emilylewis on Twitter!