Re: The canvas

> On Thu, 11 Nov 1999 10:53:30 -0800, Todd Fahrner
> (
> wrote:
> > It's been a while since I thought hard about this,
> but I remember my 
> > conclusion: the root element can have neither
> margins nor border, 
> > only padding. The "box acid test" 
> > ( was coded
> in accord with this 
> > belief.
> I can understand why you would say it can't have
> margin.  However, why
> no border?  According to CSS2 8.5.3 [1], the
> background covers to the
> border edge (not the padding edge), so there's no
> problem with dashed
> or dotted or transparent borders.  (Section 14.2 [2]
> seems to disagree
> with this, though, but 8.5.3 makes more sense.)
> I don't think your conclusion *must* follow from the
> spec.  It's one of
> the options (maybe - see below), but since the root
> element's
> background covers the entire canvas, it could just
> cover the root
> element's margin (and all the area outside the root
> element's margin
> caused by horizontal scrollbars).
> For that matter, how does your view explain that the
> background extends
> to the right when there's a horizontal scrollbar
> (since the fourth
> paragraph of CSS2 section 9.1.2 [3] says that the
> width of the root
> element is the width of the viewport)? [Matthew says
- only when width: auto]

As in:

BODY/HTML {width: auto; /* Makes width = to that of
the viewport */}

P {margin-right: -2em}

I think that the issue of HTML/BODY interaction is
just a mess. As I see it, the only logical
interpretation (avoiding any notion of 'reverse
inheritance', for which there is no kind of
authorisation in the spec) is that HTML and BODY are
equivalent, except BODY is lower down the document
tree, and thus its declarations override BODY.

In addition to this (14.2):

1. The background of the box generated by the root
element covers the entire canvas. 

Therefore, I would see the only possible
interpretation as this: HTML, as the root element,
clearly and unequivocally applies background to the
whole of the canvas.

The following quote is the next sentence after 1.
2. For HTML documents, however, we recommend that
authors specify the background for the
BODY element rather than the HTML element. User agents
should observe the following
precedence rules to fill in the background 
[of the canvas (by absolutely necessary implication)]

According to these rules, the canvas underlying the
following HTML document will have a "marble"

    <TITLE>Setting the canvas background</TITLE>
    <STYLE type="text/css">
       BODY { background:
url("") }
    <P>My background is marble.

Thus since it is stated by this example that applying
backgrounds to BODY applies them to the canvas, and
since it would be absurd to introduce a reverse
inheritance, BODY == HTML.

From Matthew Brealey ( (for law)or (for CSS))
Do You Yahoo!?
Bid and sell for free at

Received on Friday, 12 November 1999 11:24:25 UTC