Re: Mapping presentational HTML to CSS: a summary
- From: Ben C <spamspam@xxxxxxxxx>
- Date: Wed, 23 May 2007 16:51:33 -0500
On 2007-05-23, Jukka K. Korpela <jkorpela@xxxxxxxxx> wrote:
Since there is no authoritative specification on how to map presentational
HTML elements and attributes to CSS, and even no informal description (as
far as I can see), I finally composed one:
http://www.cs.tut.fi/~jkorpela/html2css.html
The idea was to create something simple, but now it looks rather messy.
Anyway, maybe it's of some use. I do _not_ recommend converting old pages
(using presentational HTML) to anything, in general, but people do such
things anyway, and people seem to ask rather often questions like "what's
valign in CSS?"
<br style="clear: both"> for <br clear="all"> is an interesting one.
Clear is only supposed to apply to block-level elements. The value of
display for <br> is not specified in Appendix D of CSS 2.1, which makes
it the default, inline, which is also what I would expect. So
technically, setting the clear property on <br> ought to be ignored,
just as it would be if you set it on <span> or <em>. But most browsers
I've tried allow it, as an alternative to using the clear attribute.
I suppose you could have <div style="clear: both"></div>. Content after
the clearing div will start a new anonymous block nested inside the one
you were in. That is mostly equivalent but there are I think ambiguities
here when it comes to containing blocks.
In this example,
<div style="height: 400px">Hello
<div style="clear: both"></div>
world
<div style="height: 50%; width: 20px; background-color: blue"></div>
</div>
should the 50% mean anything? It depends what is the containing block
for the second div: the outer div, which has a fixed height or the
auto-height anonymous block that begins before "world"? If the latter,
the 50% should be ignored.
In this case however:
<div style="height: 400px">Hello
<br clear="all">
world
<div style="height: 50%; width: 20px; background-color: blue"></div>
</div>
the 50% should definitely work out as 200px since there is no ambiguity
about which block is the containing block for the second div. The <br>
is just an inline element which causes a line break and there are no
anonymous blocks.
So arguably browsers should treat these two examples differently. If
they should, then there is no CSS equivalent to <br clear="all">.
A quibble is that you say "border-spacing: npx" for each cell. But you
set border-spacing on the table, not on the cells, and it is really a
property of the table.
.
- References:
- Mapping presentational HTML to CSS: a summary
- From: Jukka K. Korpela
- Mapping presentational HTML to CSS: a summary
- Prev by Date: Mapping presentational HTML to CSS: a summary
- Next by Date: Re: Mapping presentational HTML to CSS: a summary
- Previous by thread: Mapping presentational HTML to CSS: a summary
- Next by thread: Re: Mapping presentational HTML to CSS: a summary
- Index(es):
Relevant Pages
|
Loading