RE: XP> Margins, borders, padding, and backgrounds

From: Grant, Melinda (melinda.grant@hp.com)
Date: Thu Sep 28 2006 - 15:48:19 EDT

  • Next message: Atsushi Nakamura: "Re: XP> [CSS3 Paged Media] Page collapsing"

    Hi Ats,

    Thanks for your response.

    > Canon thinks that the <HTML> element merely defines the
    > container for the (X)HTML source document.

    Yes, it is the root or top-level container element for the document.
    But as with other container elements, it can be styled. See
    http://www.w3.org/TR/CSS21/colors.html#q2. (Ignore the paragraph
    beginning with "For HTML documents", as it does not apply to XHTML
    documents.)

    HP doesn't yet support styling of html elements, as required by the CSS
    2.1 specification. We are adding that support.

    > Canon thinks that a font property set within an @page rule
    > will be applied (inherited, may be the correct word) to the
    > page content area, unless overridden by properties set on
    > elements appearing within the page content area.

    Does Canon have an implementation that behaves in this manner? Does
    anyone else?

    > We think the body margin should extend to the bottom of the
    > page (defined by @page) Our understanding is that since the
    > body is considered the "canvas where the content appears", it
    > should be the underlining container which includes the area
    > specified by @page.

    Hopefully I have convinced you that for xhtml documents, the html
    element draws the canvas, not the body element. So if I substitute html
    for body in your statement above, the comment would be:
    + We think the html margin should extend to the bottom of the
    + page (defined by @page) Our understanding is that since the
    + html element is considered the "canvas where the content appears", it
    + should be the underlining container which includes the area
    + specified by @page.

    Does Canon have an implementation that behaves this way? Do others?

    In general, I think we all believe it's best to specify behaviors
    'tightly' -- that is, so that only one behavior is correct and others
    are incorrect. This will reduce interoperability differences, and keep
    all our clients and users happy and keep our support costs down. But
    sometimes we have to allow differences because companies (people) can't
    agree on one answer.

    Hopefully, we can all agree on one answer in these cases.

    Best wishes,

    Melinda

    > -----Original Message-----
    > From: Atsushi Nakamura [mailto:nakamura.atsushi318@canon.co.jp]
    > Sent: Wednesday, September 27, 2006 11:54 PM
    > To: Grant, Melinda
    > Cc: xp@pwg.org
    > Subject: Re: XP> Margins, borders, padding, and backgrounds
    >
    > Melinda,
    >
    > A couple of comments on this topic ;
    >
    > Canon thinks that the <HTML> element merely defines the
    > container for the (X)HTML source document.
    >
    > > * Is a font property set within an @page rule applied
    > to the page
    > > content area (unless overridden by properties set on elements
    > > rendered on the page), or just to the contents of
    > the page margin
    > > boxes? [Proposed Answer: Just to the margin boxes.]
    >
    > Canon thinks that a font property set within an @page rule
    > will be applied (inherited, may be the correct word) to the
    > page content area, unless overridden by properties set on
    > elements appearing within the page content area.
    >
    > > * On the last page of a document, do the html and body
    > properties
    > > terminate immediately after the last content, or at
    > the bottom of
    > > the page (e.g., do the html and body margins get
    > drawn right below
    > > the last paragraph, or at the bottom of the page?
    > [Immediately
    > > after content.]
    >
    > We think the body margin should extend to the bottom of the
    > page (defined by @page) Our understanding is that since the
    > body is considered the "canvas where the content appears", it
    > should be the underlining container which includes the area
    > specified by @page.
    >
    > > * Similarly, on the last page, do the page bg, border,
    > etc. extend
    > > to the bottom of the page, or terminate after the last
    > > content? [bottom of the page]
    >
    > This is Agreed.
    >
    >
    > Regards,
    > Ats Nakamura
    > Canon
    >
    > Grant, Melinda wrote:
    > > From HP's perspective (and I think we're not alone), the CSS
    > > specification is difficult to interpret with respect to how
    > margins,
    > > borders, padding, and backgrounds work when applied to the
    > <body> and
    > > <html> elements. Recently we have learned that the CSS3
    > Paged Media
    > > module is not clear on how the same properties used within an @page
    > > context should interact with the html properties.
    > >
    > > I'd like to share my new-and-improved understanding based on
    > > discussions within the CSS WG: ;-)
    > >
    > > * First, there are html attributes and there are css
    > properties. In
    > > html, the body element has a bgcolor attribute, but the html
    > > element does not. For XHTML documents, the UA (printer) must
    > > convert the body bgcolor attribute into an equivalent printer
    > > style rule:
    > > So <body bgcolor="red"> gets converted into the
    > printer stylesheet
    > > rule: body {background-color: red}. (This gets a bit more
    > > complicated for HTML documents, but we don't need to
    > go there.)
    > > This printer stylesheet rule will be overridden by an author
    > > stylesheet rule, should one exist. See
    > > http://www.w3.org/Style/Group/css2-src/cascade.html#q13.
    > > * The body element is no different when it comes to CSS
    > styling from
    > > any other element. Backgrounds, margins etc behave
    > just as they
    > > do for a div, for example.
    > > * The html element is the root element. It can also be selected
    > > with ':root'. It is special, in that a background is
    > applied to
    > > the margins as well as the content area. This is because it
    > > 'paints the canvas', which is infinite. The only way
    > in XHTML to
    > > put a background in the html margin area and/or the
    > body margin
    > > area is to use a background on the html element. (See
    > > http://www.w3.org/TR/CSS21/colors.html#q2.)
    > > * The attached file, 'margin-both.xhtml' when opened
    > with Firefox,
    > > provides an example of how html and body edgings
    > should be rendered.
    > >
    > > There are still some open questions about how @page
    > properties work.
    > > I am hoping to publish a new version within the next week
    > or so that
    > > will resolve questions such as the following: [My proposed answers
    > > are in brackets.]
    > >
    > > * Is a font property set within an @page rule applied
    > to the page
    > > content area (unless overridden by properties set on elements
    > > rendered on the page), or just to the contents of the
    > page margin
    > > boxes? [Proposed Answer: Just to the margin boxes.]
    > > * Do the html and page margins collapse? [no]
    > > * Are html and body borders closed at the bottom of
    > each page, or
    > > just at the end of the document? [Just at the end of
    > the document]
    > > * Does a background property set within an @page rule
    > get applied to
    > > the page margins? [Yes] To the page area unless
    > obscured by html,
    > > body, or other backgrounds? [????, under discussion]
    > > * On the last page of a document, do the html and body
    > properties
    > > terminate immediately after the last content, or at
    > the bottom of
    > > the page (e.g., do the html and body margins get
    > drawn right below
    > > the last paragraph, or at the bottom of the page? [Immediately
    > > after content.]
    > > * Similarly, on the last page, do the page bg, border,
    > etc. extend
    > > to the bottom of the page, or terminate after the last
    > > content? [bottom of the page]
    > > * Others?
    > >
    > > Best regards,
    > >
    > > Melinda
    > >
    > >
    > > _____
    > >
    > > HP - Melinda Grant
    > > Connectivity Standards
    > > Consumer Printing and Imaging
    > > +1 (541) 582-3681
    > > melinda.grant@hp.com
    > > _____
    > >
    > >
    > >
    > >
    > ----------------------------------------------------------------------
    > > --
    > >
    > > Subject:
    > > Re: XHTML and backgrounds
    > > From:
    > > "Bert Bos" <bert@w3.org>
    > > Date:
    > > Fri, 28 Jul 2006 08:11:46 -0500
    > > To:
    > > "Grant, Melinda" <melinda.grant@hp.com>
    > >
    > > To:
    > > "Grant, Melinda" <melinda.grant@hp.com>
    > >
    > >
    > > Hello Melinda,
    > >
    > > > So is there any difference in XHTML between setting
    > attributes on
    > > the > body versus the html elements?
    > >
    > > Do you mean attributes or properties?
    > >
    > > The <html> element doesn't have a bgcolor attribute, only
    > <body> does.
    > > And in XHTML1, the bgcolor attribute is still supposed to work the
    > > same way as in HTML. (But CSS says that the way it works is subtly
    > > different: In HTML documents, bgcolor="red" is equivalent to 'body
    > > {background-color: red}' in the user style sheet, except
    > that it has
    > > specificity=0. In XHTML documents, it is up to the UA to
    > analyze the
    > > document and construct an appropriate UA style sheet, e.g.,
    > with 'html
    > > {background-color: red}'. See section 6.4.4:
    > > http://www.w3.org/Style/Group/css2-src/cascade.html#q13)
    > >
    > > As for CSS properties, there is absolutely nothing special
    > about the
    > > <body> element in XHTML. Setting 'body {background: red}' is no
    > > different from 'div {background: red}', i.e., only the box
    > of the body
    > > itself is red.
    > >
    > > The <html> element is the root element, so it is still special. And
    > > thus the only way in XHTML to set the background of the
    > canvas is with
    > > 'html {background:...}'
    > >
    > > That is, unless...
    > >
    > > >
    > > > (I'm still trying to figure out how body and html
    > attributes should
    > > > relate to @page attributes...)
    > >
    > > ... if we allow a 'background' property inside '@page', it
    > presumably
    > > causes a background to be rendered behind the background of
    > the <html>
    > > element, if any.
    > >
    > >
    > >
    > > Bert
    > > --
    > > Bert Bos ( W 3 C )
    > http://www.w3.org/
    > > http://www.w3.org/people/bos
    > W3C/ERCIM
    > > bert@w3.org 2004 Rt des
    > Lucioles / BP 93
    > > +33 (0)4 92 38 76 92 06902 Sophia Antipolis
    > Cedex, France
    > >
    >
    >
    > --
    > Atsushi Nakamura
    > Senior Engineer
    > Inkjet Device Firmware Design 31
    > Canon, Inc.
    > 3-451 Tsukagoshi Saiwai-Ku
    > Kawasaki JAPAN
    > 212-8530
    >
    > Tel : 81-44-542-2111 ext3713
    > 81-44-548-7538 direct(shared)
    >
    > E-mail : nakamura.atsushi318@canon.co.jp
    > --
    >



    This archive was generated by hypermail 2.1.4 : Thu Sep 28 2006 - 15:48:26 EDT