March 22, 2004

The Myth of CSS, and the Response

Alex King posted some thoughts about how using CSS to seperate content and presentation is a farce. A powerful statement. And one I don't buy for a minute.
The ugly truth is this: almost all CSS/XHTML sites have their own version of tag soup in a combination of extra DIVs, SPANs and BRs used purely for formatting and blocks that have to appear in a certain order for an effect to be applied properly.

There are limitations to what you accomplish with CSS alone; in many cases your XHTML has to submit to minor alterations for styling to be applied the way the designer intended. A true separation of content and presentation would mean you could make your changes purely in the CSS without making changes to the XHTML. Many times, that is not the case.
Anne Van Kesteren has a very good response to this arguement.
DIV and SPAN however, have no defined meaning.
...
In HTML we need these elements for situations where we donít have the right elements to do the job and sometimes we need them to “hack” around browser limitations. You could say that they are useless at that point, but please remember they have no defined meaning (that is very important).
And as for the second part of his arguement, about the seperation of content and presentation? Again we go back to Anne (because it's early, I don't feel like REALLY writing, and he's already done the work). And Anne points us to Eric Meyer, who stated:
My semantic correction is that we arenít trying to separate presentation and content, but presentation and structure. Doug makes this point throughout the latter part of his post, but I think this is the important thing to state right up front. Without content, itís very difficult to have any presentation, except maybe a blank browser window (very minimalist, but not necessarily useful).
The comment thread at Anne's site has some wonderful thoughts in it as well.
Post Info

Tagged As CSS

Comments are Open (3)

Posted at 07:42 AM

Comments

Alex

You're missing (and misrepresenting) the point of my post. My claim is simply that we have not yet achieved a 100% clean break of presentation and content with XHTML and CSS. There is still code being used for presentation in the XHTML.

Tony

I don't mean to misrepresent you. And I certainly don't mean to cast you in a bad light.

I think you raised some very good questions. And some good points. I was just feeling very lazy this morning, and used the content of others (you, Anne and Liorean) to represent what I was feeling.

However, I don't think you'll be able to fully seperate presentation from content/structure until XML and XSLT is fully realized. Which might be a while.

Let's look at a simple CSS class. Call it foobar.

<p class='foobar'>

That's is completely correct. And it's tied to the content. Inheriently. It has to be.

Same for span, divs (see Anne's response for those reasons), and even in-line markup such as strong, em, etc. Those are presentational items.

But I do agree with you that people will continue to muck up the standards. Always going to happen. Hell, I do it from time to time.

It boils down to expectations. "How do I get this done quickly and out the door?" Sure, it might be ugly, but _it's good enough_. I hate that, but I've had to fall back upon that in the past, because I needed to.

Alex

I'm not even advocating 100% separation of content and presentation. XHTML isn't pure data IMO, I think it's ok to have some presentation code in there.

I often hear people tout separation of presentation and data as a reason to use CSS - I don't agree that it accomplishes that. I also don't think that it should, but I didn't make any claims either way about that point.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Search
Comments on this post
Categories
Info
Tony Stephens
Copyright © 1995-2005
Site Version:
10
Licensed:
Creative Commons
Validate:
XHTML, CSS, 508, RSS
Subscribe
Blog-Fu, Link-Fu