[thelist] Total separation of content and presentation

Peter-Paul Koch pp.koch at gmail.com
Tue Dec 21 14:55:00 CST 2004


> What we're trying to accomplish is a page laid out in the CSS,
> independent of the order/structure it appears in the HTML.  <divs> that
> are independent of one another and could be relocated, within the CSS,
> without having to go into the HTML.  Not using container <divs>, if
> it's possible.
>
> We're trying to establish our 'perma-code', so should a new design come
> down the pike, we could modify the style sheets in a few locations,
> rather than go in to thousands of HTML pages and do the restructuring
> there. 

It's an interesting idea, but as far as I can see it's still one bridge too far.

A client of mine wanted exactly the same, and pointed to CSS Zen
Garden to prove that one HTML structure can support a myriad of
styles. At first I enthousiastically agreed that this would be a
workable solution, but I turned out to be wrong.

I succesfully ported the first design to CSS, and made sure to create
structural HTML that could support more style sheets than just that
one (though I continued to use wrapper divs).

However, the second design my client sent me required the HTML
elements to be in a different order. The first design had a left
sidebar for the navigation, the second one placed the navigation on
the right.

If I'd been forbidden to change the order of the HTML elements, I
wouldn't have had any choice but to use absolute positioning, which in
general I think is too rigid for any but the simplest sites. To
continue with my float-approach, I needed to change the order of the
HTML elements in the source code.

So I changed the order of the HTML elements and worked out a system to
allow each different design to use slightly different HTML. This works
fine, and it serves the needs of my client, but it didn't achieve
perfect separation of structure and presentation.

Therefore I advise you not to stare yourself blind on the perfect
separation, but to accept that

a) you need wrapper divs
b) different designs may need a different HTML source code order,
unless you go for absolute positioning, which is not the most portable
of solutions

In short: what you want can't (yet?) be achieved.

-- 
-------------------------------------------------------------------
ppk, freelance web developer

Bug Report: Report bugs yourself, or comment on previously 
reported ones.
http://www.quirksmode.org/bugreports/
------------------------------------------------------------------


More information about the thelist mailing list