Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    Jul 2011
    Location
    Kansas
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Question How do I Add BG-Color to this H3?

    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...

    Code:
    div#navigation
    {
    	background-color:#ffffff;
    	border: 2px solid #000000;
    }
    Last edited by Skylear; 07-22-2011 at 05:48 PM. Reason: I meant h2.

  • #2
    Regular Coder
    Join Date
    Aug 2006
    Location
    Cardiff, UK
    Posts
    141
    Thanks
    15
    Thanked 2 Times in 2 Posts
    Umm… there's no h3 element in the code you've posted. You could give us a bit more to go on!
    If anyone asks my boss, this counts as work, okay?

  • #3
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,335
    Thanks
    5
    Thanked 363 Times in 360 Posts
    ??

    h3 {
    background-color: red;
    }
    Teed

  • #4
    New Coder
    Join Date
    Jul 2011
    Location
    Kansas
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Thumbs down

    Quote Originally Posted by butlins View Post
    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.

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

  • #5
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,335
    Thanks
    5
    Thanked 363 Times in 360 Posts
    Quote Originally Posted by Skylear View Post
    Aw crap... Got the wrong piece of CSS... sorry. :/
    I also actually meant H2, when in a rush.... things don't go right.

    Code:
      
    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;}
    Teed

  • Users who have thanked teedoff for this post:

    Skylear (07-22-2011)

  • #6
    New Coder
    Join Date
    Jul 2011
    Location
    Kansas
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Thumbs up

    Quote Originally Posted by teedoff View Post
    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. >_<

  • #7
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,722
    Thanks
    41
    Thanked 191 Times in 190 Posts
    just an after thought... did u have a chached page or something?
    Code:
    #navigation h2{background-color:red;}
    should target every h2 child element within the #navigation div... or did u have a typo?

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE

  • #8
    New Coder
    Join Date
    Jul 2011
    Location
    Kansas
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts
    @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


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •