Click to See Complete Forum and Search --> : Have I misunderstood bgcolor?


peytontodd
11-02-2009, 07:15 PM
The web page I'm writing consists mainly of a large table with a #60253A (maroon) background. But it doesn't fill the whole browser window, and I would like all parts of the browser window outside the table to have the same #60253A background so that the table is not distinguishable as a separate entity. I am attempting to implement this with:

<body bgcolor="#60253A">

But no matter what color I choose (green, etc.) the area outside the table always appears white.

Please note the following:

- The <html><head></head><body></body></html> tags are all in their correct places.

- The table is set to border="0", cellspacing="0", cellpadding="0", and style="margin:0".

- The white area outside the table is about a quarter inch on the top and left side, but apparently infinite (as far as one can drag the web page border) on the bottom and right side.

What could I be doing wrong?

Thanks for your help,

Peyton :confused:

themonkey40
11-02-2009, 11:41 PM
Can you post the entire page code. Thanks

Coyotelab
11-03-2009, 02:39 AM
Use CSS:
<html>
<head>

<style type="text/css" media="screen">
body { background: #60253A;}
</style>

</head>

<body>


</body>
</html>

peytontodd
11-03-2009, 07:02 AM
Yay! Setting the body background as a style was successful.

But I'm wondering... even though it's only of academic or historical interest at present... why did bgcolor=<color-name> not work? Have more recent browsers stopped supporting it? (My latest HTML book is copyright 2000.)

Many thanks,

Peyton :D

peytontodd
11-03-2009, 07:09 AM
Ah-ha! Looking at my CSS page, which I had borrowed from someone else and cannibalized, I find that the <body> tag was being set with a white background there, which was overriding the bgcolor in the body tag itself.

Nevertheless, I'm going with the CSS method in attempt to be a bit more standards-compliant.

Peyton :rolleyes:

peytontodd
11-03-2009, 07:17 AM
Except that if I try to solve the problem just in on the CSS page, it doesn't work. So I'm sticking with placing the style statement within the header as proposed.

My CSS page is being loaded properly, by the way, or loads of other stuff would be going wrong. So doubtless it's some other mistake I made, but I've decided not to worry about that until it bites me, given the time pressure...

Thanks again, though.

Peyton

criterion9
11-03-2009, 09:13 AM
CSS rules overwrite more general rules always. This means that a style set in an external file will be overwritten by a rule in the head, and that rule is overwritten by a rule inline. Additionally the last declaration that is as specific as previous ones will also overwrite any existing rules.