A Blog Not Limited

to web design, standards & semantics

Attribute Selectors for Efficient CSS

Feb 08, 2011

Published in

I'm a big believer in working efficiently so I don't have to work too hard. From time and project management, to the CSS and HTML I write, efficiency is key to me having a life outside of work.

When I worked for the corporate dooshes, efficiency was often talked about during the oh–so–efficient "town hall meetings," but rarely encouraged in practice. Instead, the corporate mentality of getting it done regardless of whether it was done right prevailed. And I spent hours, days and weeks cleaning up CSS and HTML that my former employer frequently outsourced to agencies who only understood tag soup, div-itis and class-itis.

If I had a penny for every convoluted selector that could've been replaced with an advanced selector, I'd be a very rich woman today. Instead, I'm now freelance, where I get to be as efficient as I want, particularly with my CSS.

Attribute Selectors

One of the ways I'm getting more efficient with my CSS these days is by using "advanced" selectors. Attribute selectors, specifically, have become a very common part of my CSS arsenal. I love how they target elements without me having to include any class or id values. They simply rely on the attributes I'm already assigning in my markup for content — rather than presentational — purposes.

If you want to learn more, check out my latest article about attribute selectors for Script Junkie.

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!

Tags:

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.

More

I Tweet, Therefore I Am

Follow @emilylewis on Twitter!