Re: Background image excluding margins

A case can be made for either implementation.

BUT, what happens if you place the style on the <body> element?


Note the paragraph starting "For HTML documents..." (which includes XHTML as well), the recommendation is to promote any 'background properties' on the <body> element to the parent root element.† Nothing is said about similarly promoting other properties, such as margins.† Thus placing your styling on the <body> element should have the desired effect: the background fills the canvas and the margins are imposed on all subsequent content.

I do not have the ability to test this.† Perhaps someone else can report results.

As I recall, the results of styling the <html> element are inconsistent across browsers and therefore best avoided.

Chris Beall

--- On Thu, 8/13/09, Josť Carlos Santos <> wrote:

From: Josť Carlos Santos <>
Subject: Background image excluding margins
Date: Thursday, August 13, 2009, 5:31 AM

Hi all,

Imagine a HTML page which uses a stylesheet containing a line like:

html {margin-left: 4% ; margin-right: 4% ; background-color: white ;
 background-image: url(sandston.gif) }

When I see such a file with Amaya, the background image also obeys the
"margin-left: 4% ; margin-right: 4%" request. In other words, the image
doesn't extend to the border. Is this the intended behavior? With any
other browser that I have access to, the request concerning the margins
applies to text alone, and I think that that's how it should be.

Best regards,

Jose Carlos Santos

Received on Thursday, 13 August 2009 16:13:57 UTC