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

From: Grant, Melinda (melinda.grant@hp.com)
Date: Thu Sep 21 2006 - 21:07:12 EDT

  • Next message: Grant, Melinda: "XP> [CSS Paged Media] Margin Boxes and the Page Border"

    Hi Elliott,
     
    > When a property and its equivalent attribute are specified, which one
    wins? I don't recall seeing this anywhere, but maybe I missed it.
    Since the attribute is converted into a *UA* (printer) stylesheet rule,
    the *author* stylesheet rule specifying the property will override the
    UA setting and win.
     
    A note on the non-printable region issue: I have the following wording
    proposed for the upcoming release:
    It is recommended that user agents with a non-printable area
    <outbind://90/#non-printable-area> (that is, user agents which cannot
    print over the entire sheet surface) establish a default page margin via
    the user agent stylesheet that includes the non-printable area. It is
    further recommended that authors assume that the default page area will
    not include unprintable regions.
     
    The intent here is that authors have a tool to avoid unprintable
    regions. That won't eliminate the problem you describe in #2 below, but
    it hopefully limits the problem to poorly-designed pages.
     
    Best wishes,
     
    Melinda

    ________________________________

            From: Elliott Bradshaw [mailto:Elliott.Bradshaw@Zoran.com]
            Sent: Thursday, September 21, 2006 2:40 PM
            To: Grant, Melinda; xp@pwg.org
            Subject: RE: XP> Margins, borders, padding, and backgrounds
            
            

            Hi Melinda,

             

            This is very helpful. At first blush I'm inclined to agree with
    all your suggestions.

             

            I would like to raise 2 related issues for discussion by the
    group:

             

            1. When a property and its equivalent attribute are
    specified, which one wins? I don't recall seeing this anywhere, but
    maybe I missed it.

             

            2. When a printer has nonprintable margins, how should we
    handle them (assuming they exceed the applicable page/body margins)?
    One approach is to simply clip the content, but this seems to me to run
    against the spirit of "content is king". Another approach would be to
    shrink to fit so that the inside-the-margins area is shrunk slightly and
    perhaps shifted to fit inside the physically printable area. The
    algebra is a little tricky when we are also shrinking to fit a smaller
    page size, but I think this could be solved.

             

            I'm wondering what people think about these, and whether we
    should try to decide them and publish the answer somewhere. If there is
    interest in shrink-to-fit for #2, I can write up a more specific
    proposal.

             

            Cheers,

            Elliott

             

             

            
    ________________________________

            From: owner-xp@pwg.org [mailto:owner-xp@pwg.org] On Behalf Of
    Grant, Melinda
            Sent: Wednesday, September 20, 2006 4:49 PM
            To: xp@pwg.org
            Subject: XP> Margins, borders, padding, and backgrounds

             

            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
              _____

             



    This archive was generated by hypermail 2.1.4 : Thu Sep 21 2006 - 21:07:21 EDT