Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Div background color in Netscape

Status
Not open for further replies.

budha1

Programmer
Nov 6, 2002
19
0
0
US
I have a div tag surrounding my main content in my html document. For some reason, when I preview my page in Netscape (4.51, 4.8, and 6.1) the background color I have defined for the div in my stylesheet does not appear.

My HTML code appears as follows:

<div id=maincontent&quot;>

HTML code

</div>

Here is the code for my stylesheet:
#maincontent {
height: 100px;
left: 15%;
position: absolute;
top: 25px;
width: 650px;
z-index: 1
; background-color: #FFFFFF
; border: none
; padding-right: 2px; padding-left: 2px; padding-top: 2px
; clip: rect( )
}

Is there some workaround for this that I'm not aware of?

Thanks!!!
 
budha1,

First, there's a typo in your DIV line. It should be
Code:
<div id=&quot;maincontent&quot;>

Second, may I recommend you do your DIV after you specify your external stylesheet? So, rather than

[tt]
<div>
<html>
<head>
<link...>
</head>
<body>
content
</body>
</html>
</div>
[/tt]


you would use

[tt]
<html>
<head>
<link...>
</head>
<body>
<div>
content
</div>
</body>
</html>
[/tt]


Cheers,
[monkey] Edward [monkey]

&quot;Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!&quot; -- inventor of the cat door
 
Sorry for the confusion. I actually do place my div after I link to my external style sheet. I have been able to get the background color to appear in Netscape 4.51 and 4.8. I used an in-line style to acheive this: <div id=&quot;maincontent&quot; style=&quot;background-color: white; layer-background-color: white;&quot;> However, the background color still won't appear in Netscape 6.1.

Are there any suggestions on how to make the background color appear in Netscape 6.1?

Thanks!
 
budha1,

Please explain something. It is my impression that you are already specifying some sort of background treatment (a color or image or whatever) in the CSS and that the specified background appears as expected.

But you want -- for the extent of this DIV -- a different background color, so you are attempting to use an inline style to override the external style.

Is that what you're trying to do?

Finally, in the spirit of random guesses, have you tried specifying
Code:
div.maincontent {background-color: #FFFFFF;}
in your stylesheet, instead of using the hash?

Cheers,


Curious,
[monkey] Edward [monkey]

&quot;Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!&quot; -- inventor of the cat door
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top