cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <stef...@apache.org>
Subject Re: [OT] Design Rant
Date Thu, 20 Dec 2001 16:13:52 GMT
Alistair Hopkins wrote:

> Pragmatism over purism, I say.

Amen.

Let me give you my personal impression:

1) CSS2 is not flexible enough to completely separate layout information
from the HTML flow. Even worse, since the spec allows 'compliant'
browsers to ignore the 'display' attribute, there is no way you can
position your 'divs' horizontally without making a mess.

Even more: look into /mozilla/res/html.css which is the mozilla-default
CSS for HTML and you'll see a bunch of -moz-xxx stuff that they added to
CSS (some are extentions, but some are admittedly features missing in
the spec!).

Sorry, CSS2 is cool, but it's not a solution to the separation of
concerns problem.

2) XSLT, on the other hand, is nothing about style: it's a
transformation language (despite the name). In theory, we could have the
web site written using pure XML and format that with CSS2. It will take
another while for people to realize that 

 section { content: attr(title) }

is similar to 

 <xsl:value-of select="section/@title"/>

but I think that using CSS2 to augment the infoset is asking for
trouble.

3) Thus, it makes perfect sense to go

 XML -(XSLT)-> XHTML -(CSS)-> Screen

but without the availability of the 'display' property (look into the
CSS spec if you don't know what this is, because you're missing the most
important stuff), there is no way you can avoid targetting XHTML
elements to drive the formatting.

For example, in theory, I could do:

 <div class="site-logo">...</div>
 <div class="project-logo">...</div>
 <div class="search-form">...</div>

and want them positioned as

 +----------------------------------------------+
 |site-logo       project-logo       search-form|

but IE interprets 'div' as 'blocks' and blocks follow a vertical flow so

 +----------------------------------------------+
 |site-logo                                     |
 |                project-logo                  |
 |                                   search-form|

I could try with 'span', which is an 'inline' object but then I loose
the ability to know how to 'center' something since I only have relative
positioning that accepts a fixed amount or a percentage amount (but you
can't define the percentage of "what", it's fixed to be the percentage
of the including block.... so how do I know what is that percentage in
order to make it centered?)

CSS2 has an entire set of different flow objects (just like XSL:FO, BTW)
and "display: table-column" would do it, but the CSS2 specs says (page
102)

 Conforming [p. 32] HTML user agents may ignore [p. 42] the ’display’
property.

Guess what? IE is conforming to that precisely and ignores the property
alltogether.

This means that no matter how hard you try, you can't separate
presentation from content in XHTML+CSS, thus you can't turn your "divs"
into "td" in a portable way.

So, in short: if you need a sidebar in XHTML, you need a table.

NOTE: you could use CSS 'floats' for a sidebar, but 'floats' have the
weird property that only inline objects are diplaced, so, if you have a
'pre' element with a gray background in your content, the sidebar float
might 'squeeze' the text in the 'pre' block, but doesn't change the box
and the sidebar might well run over it.

RESULT: I'm all for using CSS where it makes sense, but, unfortunately,
it's not possible to completely avoid the use of HTML tables to drive
presentation without missing incredibly common functionality such as
coherently-resizable and horizontally-placed blocks.

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<stefano@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message