Markup Slacker

April 17, 2007

Since reading Andy Clarke's Transcending CSS, I've come to the realization that I'm a slacker. Reading along as Clarke created superb web pages without a solitary div was an eye-opening experience. Not altogether a comfortable one. Because soon after, I had to open up a file of my own HTML markup and confront The Creature. Compared to Clarke's spartan clean markup, mine was hideously blemished with divs and ids and classes. I tell you, even now, my face pales and my heart is filled with shame. Okay, maybe not. But I did pull my hair once and grumble, "Jesus, what the hell am I doing?" You see, I've studied CSS and HTML markup for two years now. I haven't studied rigorously for two years... Especially, maybe, the last year. Or so. But still. I should be something of an expert, don't you think? I know what I'm doing, right? Wrong. The more I read, the more I discover how much more there is to know about CSS and HTML. And of course, the busier we get at work, the less attention I pay to the rules of proper markup. When you're in a hurry, it's so easy to toss in a div or slap on an id and rush the page out. Also (not to make excuses, but...) lately a lot of my work involves CMS like MediaWiki and, especially, Drupal. CMS are worse than DreamWeaver. They spit out junk code like a third-baseman with a wad of chew. So my new personal top mission (dislodging the search for the perfect periwinkle shirt to go with my new pants) is to see if I can get Drupal to generate cleaner markup. I'm going to start with the Zen theme, which I've used several times and find fairly easy to customize. I'll let you know how it goes, just as soon as I get done wresting with The Creature.

Comments

I've had a similar experience with cms's. I never quite found one that I could commit to...and the code they output was just one factor in that. So, I'm making my own. The lengths we go to...

Cool. Let us know how it's going.

I would say that CMS alone are not guilty for bad code output... WYSIWYG editors are the main bad guys of crapy output code. Try changing your editors.

I know exactly how you feel! I am constantly embarrased of my markup. Drupal drives me crazy with it's divs. I know why the divs are created, and I understand the reasoning, but it's just NASTY! I hate having a junk like this (sorry about the formatting):

<div class="content">
<div class="view view-featured-videos">
<div class="view-content view-content-featured-videos">
<div class="item-list">
<ul>
<li>
<div class="view-item view-item-featured-videos">
<div class="view-field view-data-node-title">
<a href="#">Video Link</a>
</div>
</div>
</li>
<li>
<div class="view-item view-item-featured-videos">
<div class="view-field view-data-node-title">
<a href="#">Video Link 2</a>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>

I mean... is this really neccessary, just to display an unordered list?

I've been doing alot of research on creating a base template that eliminates all of this extra crap, but the problem is that some of it is hardcoded, and nearly impossible to override in template.php.

DAVOR--You're right that WYSIWYG editors are notorious for creating junk code, although I've heard Dreamweaver CS3 is vastly improved. Don't know for sure because I code by hand.

Jared--Have you tried Content Templates? It's pretty nifty. Let's you modify fields and markup.

Kathy, I've used contemplate, but I like the finer control of phptemplate's granular templating. (How many times can I say the word 'template' ?!)