Let’s talk about CSS, baby

20100829 · 0 comments

Okay, I have a bone to pick with you, Inter­net. Can we please agree to code our HTML attrib­utes (class, id) in a bet­ter way?

Here’s my posi­tion: hyphens are supe­rior to underscores

I can back this up with at least two arguments.

  1. In most text edi­tors that I’ve used, key­board short­cuts CTRL+Left/Right/Backspace will skip over under­scores, but not hyphens. So that means if I’m try­ing to tra­verse (via key­board, like a good com­puter ninja) over
    some_long_ass_CSS_class_name_someone_wrote

    then I’ll have to suc­cumb to try­ing to guess how long to hold Left/Right… or worse yet, use the mouse!

  2. It’s an extra key­stroke to type an under­score. Over the course of one small project, this might not seem a lot, but if it’s your craft & pro­fes­sion, This is a lot of extra key­strokes. Plus, it would speed up your probably-inevitable-RSI.

MailChimp, I’m look­ing at you!

As much as I love MailChimp, I was frus­trated when try­ing to style their embed­d­a­ble signup form. All these underscores!

Agree/Disagree?

I’m going to start using this for­mat for writ­ing my code. In fact, I already have. If you look at my recently redesigned home­page and inspect the first image on the page (me stand­ing in the sub­way) you’ll see the link sur­round­ing it is class=“pants-toggle” and the image itself has class “no-pants”.

If you dig on this, imple­ment it your­self. Either way, I want to hear what you think in the comments.

Leave a Comment

Previous post:

Next post: