Re: Mapping presentational HTML to CSS: a summary



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.
.



Relevant Pages

  • Re: Event Handling via CSS
    ... 'mouseover', 'mouseout' etc  attached to html elements. ... JavaScript event handlers via css for CSS attributes like "hover"? ... are HTML elements which don't have any event handlers directly ... your understanding of frameworks seems flabby. ...
    (comp.lang.javascript)
  • Re: browser incompabilities
    ... >>> images and then make images in the right sizes and upload the lot to a ... > There's also an error in your CSS: ... > the new order of html elements) see if it still goes wrong? ... As to the font property, I'm under the impression that it's a superclass of ...
    (comp.infosystems.www.authoring.stylesheets)
  • Re: Event Handling via CSS
    ... 'mouseover', 'mouseout' etc  attached to html elements. ... JavaScript event handlers via css for CSS attributes like "hover"? ... are HTML elements which don't have any event handlers directly ... Banned immediately for stating that jQuery uses browser sniffing. ...
    (comp.lang.javascript)
  • Re: Damn you, FEDEX! or Nikon D40 lost in Springfield, MO blackhole.
    ... the 2 mp Mavica he had been using with a Nikon D40. ... After shopping around, he got me to order one for him. ... The shipper had it insured, but from what I have read it could take weeks to sort this crap out. ... You may get your insurance from FedEx and a couple weeks later they find it and deliver it. ...
    (alt.photography)
  • beginning css: setting block widths for multi-browser compatability?
    ... I've been bashing away at the CSS ... I really want the CSS boxes to be the same size as the HTML elements ...
    (comp.infosystems.www.authoring.stylesheets)

Loading