...

View Full Version : Resolved How do I Add BG-Color to this H3?



Skylear
07-22-2011, 02:23 PM
I've tried background-color, and a couple of other things, but I can't remember how to get the *FIX* H2 to have a background color...



div#navigation
{
background-color:#ffffff;
border: 2px solid #000000;
}

butlins
07-22-2011, 03:50 PM
Umm… there's no h3 element in the code you've posted. You could give us a bit more to go on! ;)

teedoff
07-22-2011, 04:02 PM
??

h3 {
background-color: red;
}

Skylear
07-22-2011, 04:20 PM
Umm… there's no h3 element in the code you've posted. You could give us a bit more to go on! ;)

Aw crap... Got the wrong piece of CSS... sorry. :/
I also actually meant H2, when in a rush.... things don't go right.



div#navigation h2
{
font: bold 16px Verdana,sans-serif;
text-align:center;
background-color:#0066CC;
}

teedoff
07-22-2011, 04:22 PM
Aw crap... Got the wrong piece of CSS... sorry. :/
I also actually meant H2, when in a rush.... things don't go right.



div#navigation h2
{
font: bold 16px Verdana,sans-serif;
text-align:center;
background-color:#0066CC;
}




Again, the code I posted above will set a color of red to every h2 tag. If you want to only style ONE h2(if your page has more than one h2 on it) then you can set a class to the h2 tag and style that class.

<h2 class="redHeading">

.redHeading {background-color:red;}

Skylear
07-22-2011, 04:30 PM
Again, the code I posted above will set a color of red to every h2 tag. If you want to only style ONE h2(if your page has more than one h2 on it) then you can set a class to the h2 tag and style that class.

<h2 class="redHeading">

.redHeading {background-color:red;}

Thanks, teed. I had a perfectly working CSS before, but I must've accidently deleted it. >_<

alykins
07-22-2011, 04:49 PM
just an after thought... did u have a chached page or something?


#navigation h2{background-color:red;}

should target every h2 child element within the #navigation div... or did u have a typo?

Skylear
07-22-2011, 05:28 PM
@Alykins
It's okay, teed showed me how to target all h2's, which I found better than individually CSS all h2's within their respective divs. I'm a suckish newbie to the world of web development. :P



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum