CSS Makes Me Cry - Three Reasons

Ah, the beauty of styling web pages with Cascading Style Sheets. But it brings such pain. I was banging my head against my monitor again today, trying to put together two simple pages. After three hours of that I wiped my tears away, blew my nose, and returned to blogging.

These are the things that bother me most about CSS:

1. No named constants. If I were writing a program in any language, and I used the same values—colors, strings, numbers, whatever—again and again, I’d define constants for those values. It would make my code easier to write and to understand. But in CSS I’m stuck with using hex values for colors. Sure, I can stick comments all over the place but that’s no substitute. You can do constants with a CSS preprocessor, but I want it baked into CSS.

2. No simple grid layout mechanism. With its layout and positioning complexity, CSS makes it hard if not impossible to build simple grids where widths and heights of columns stretch in predictable ways. CSS gurus have developed all sorts of baroque methods for getting around this. I’m glad I picked up Jeffrey Zeldman’s book Designing with Web Standards. He usefully suggests using CSS-styled tables with XHTML 1.0 transitional as a productive way of getting layouts done.

3. Cool effects often require non-semantic markup. I love big swooshy quotes. Multi-column lists sound great. But it’s frustrating that achieving these things sometimes compromises the cleanness of the markup. As a programmer by temperament and training, I prefer perfect meaning to perfect pixels. My problem may be that I’ve spent too much time reading CSS books by graphic designers. Perhaps I need to find a CSS reference written by a programmer.

Tomorrow, back to the CSS crying game.

categories:

2 Comments

  1. Posted January 12, 2006 at 4:36 am | Permalink

    Anne,

    You’re so right. CSS is so frustrating. CSS-P (positioning) is not yet properly supported by most browsers. There is CSS code, however, that works cross-browser.

    If you haven’t already done so, start at CSS Zen Garden (http://csszengarden.com) or CSS Vault (http://cssvault.com). Both have examples of what can be achieved with CSS.

  2. Posted January 12, 2006 at 6:20 pm | Permalink

    Raj, thanks for the suggestions. I’ve looked at the Zen Garden and even have the book. The trouble with that is the markup is fixed. I will check out CSS Vault.

Post a Comment

Comments are moderated. Rude comments may be edited or deleted.

Your email is never published nor shared. Required fields are marked *

*
*