Forum Moderators: not2easy

Message Too Old, No Replies

Set background-color to nothing

How do I set a background color to nothing

         

wibble

11:27 am on Mar 9, 2004 (gmt 0)

10+ Year Member



If i have my standard stylesheet which sets a background color of an h1 to a color, how do I over ride this in a second, more specific, style sheet and take off that backgound color, eg set it to nothing?

is it possible?

Alternative Future

11:59 am on Mar 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi wibble,

I think either of these should work:

[stylesheet]
h1.newH1{
background-color: #ffffff
}

.newH1{
background-color: #ffffff
}
[/stylesheet]

[h1]
<h1 class="newH1">Heading One</h1>
[/h1]

This obviously sets the background color to white, is that what you are after?
You can also use transparent if your background colors differ.

-George

matc

12:16 pm on Mar 9, 2004 (gmt 0)

10+ Year Member



be careful Netscape 4.7 doesn't like background-colors to the body element in CSS - it renders them as Black so if you have black text you have problems.

grahamstewart

12:27 pm on Mar 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In the second stylesheet you can set the background color of the h1 to either 'transparent' or 'inherit'.

wibble

2:33 pm on Mar 9, 2004 (gmt 0)

10+ Year Member



AF, thanks for the reply. I didn't really want to set it to a color as this may obscure background images.

The 'transparent' option works a treat though, thanks GS.

grahamstewart

3:04 pm on Mar 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No problem, but I can't really take the credit - Alternative Future (aka George) actually suggested it first. :)

wibble

9:26 am on Mar 12, 2004 (gmt 0)

10+ Year Member



doh! Thanks to both of you :)