Previous Message
Next Message

background-color oddity with XHTML 1.0 Transitional?

Sent by Rick Flower on 16 January 2005 03:03


Eric A. Meyer wrote:

> At 21:53 -0800 1/14/05, Rick Flower wrote:
>
>> I'm hoping that someone can clue me in on why the website listed 
>> below (a tutorial site) has a solid grey background when the doctype 
>> is listed as HTML 4.01 Transitional, but when switched over to XHTML 
>> 1.0 Transitional (on my own server) it only has the grey background 
>> on the areas that actually have content -- meaning about the first 
>> 1-2" on the top of the page. The rest of the page is white.
>
>
>    That's because XHTML 1.0 Transitional, in browsers such as Firefox 
> and IE6, triggers what's known as "standards mode".  In this mode, 
> browsers do their utmost to follow the CSS specification (as well as 
> XHTML and others) without regard for legacy behaviors.  What it's 
> doing is correct: the 'body' element is only as tall as its content.

Excellent!  That makes me feel *much* better.. Chock it up to being a 
CSS newbie on a serious learning curve!

>> Is there a way to get the background color over the entire page 
>> instead of the just the area that has content and still have XHTML 
>> 1.0 Transitional?
>
>
>   html {background: #D6D6D6;}
>
> That's because the root element covers the viewport, which is what I 
> suspect your want ("page" is an ambiguous term).  In XHTML, 'body' is 
> not the root element, and so does not cover the viewport.  It may 
> appear to for long documents, but that's an illusion: it's actually 
> longer than the viewport in those cases.
>
Cool.. I've tried this and it works like a charm.. I'd also like to 
thank John Lewis who made this suggestion as well (but at the time I 
hadn't actually tried it yet)!

This list is the greatest CSS resource out there!  Thanks!

-- Rick

______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread: