SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict Banana Man's Avatar
    Join Date
    Dec 2005
    Posts
    391
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Header Tag for specific Div

    Hi,

    Having a bit of trouble setting up a <h2> tag for a specified Div and would appreciate some advice. When i use this code anything that is specified in the .articles_div h2 will override the original H2 tag but if i dont specify something the original h2 tag will set properties that i dont want. How come this is happening even though i am specifying the div the H2 tag is in?

    Thanks

    Code:
    <div class="articles_div">
      <h2>Diet Advice</h2>
    </div>
    
    h2 {
    	font-family: Sue Ellen Francisco, Verdana, Arial, Helvetica, sans-serif;
    	font-size: 30px;
    	line-height: 40px;
    	color: #73A780;
    	margin: 20px 0px 0px 0px;
    }
    
    .articles_div h2 {
    	font-family: Verdana, Arial, Helvetica, sans-serif;
    	font-size: 0.9em;
    	color: #e3963e;
    	font-weight: bold;
    	margin: 0px 0px 20px 0px;
    }

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,114
    Mentioned
    448 Post(s)
    Tagged
    8 Thread(s)
    This sounds strange. A rule for

    .articles_div h2 {}

    can't affect any <h2> that isn't in a div with class .articles_div.

    Perhaps link us to a live page so we can vestigate further.
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."

  3. #3
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,564
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Are you saying that regular h2s are getting unwanted styles, suchas the styles from articles_div h2{}? If so, we will need a link, or even a sample page with this behavior happening. Slimming the page down should help a lot, though isn't neccessary.
    Quote Originally Posted by Banana Man View Post
    Hi,

    Having a bit of trouble setting up a <h2> tag for a specified Div and would appreciate some advice. When i use this code anything that is specified in the .articles_div h2 will override the original H2 tag but if i dont specify something the original h2 tag will set properties that i dont want. How come this is happening even though i am specifying the div the H2 tag is in?

    Thanks

    Code:
    <div class="articles_div">
      <h2>Diet Advice</h2>
    </div>
    
    h2 {
    	font-family: Sue Ellen Francisco, Verdana, Arial, Helvetica, sans-serif;
    	font-size: 30px;
    	line-height: 40px;
    	color: #73A780;
    	margin: 20px 0px 0px 0px;
    }
    
    .articles_div h2 {
    	font-family: Verdana, Arial, Helvetica, sans-serif;
    	font-size: 0.9em;
    	color: #e3963e;
    	font-weight: bold;
    	margin: 0px 0px 20px 0px;
    }
    Twitter-@Ryan_Reese09
    http://www.ryanreese.us -Always looking for web design/development work


Bookmarks

Posting Permissions

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