XP> Margins, borders, padding, and backgrounds

XP> Margins, borders, padding, and backgrounds

Atsushi Nakamura nakamura.atsushi318 at canon.co.jp
Thu Sep 28 02:53:33 EDT 2006


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 at hp.com   
>   _____ 
> 
>  
> 
> ------------------------------------------------------------------------
> 
> Subject:
> Re: XHTML and backgrounds
> From:
> "Bert Bos" <bert at w3.org>
> Date:
> Fri, 28 Jul 2006 08:11:46 -0500
> To:
> "Grant, Melinda" <melinda.grant at hp.com>
> 
> To:
> "Grant, Melinda" <melinda.grant at 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 at 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 at canon.co.jp
--



More information about the Xp mailing list