CSS question on targeting sub class

2 replies
  • WEB DESIGN
  • |
<div class="col span_2_of_3"> <div class="contact-form">
<h3>Contact Us</h3>
i want to target the H3 for my contact us page since other pages are looking good with color yellow but the contact us page i want a black font-color. What CSS syntax can i use to target the H3 on that specific page only fellow designer warriors.
#class #css #question #targeting
  • Profile picture of the author Brandon Tanner
    Assuming that's the only div that uses the "contact-form" class, then you can do...

    CSS:
    Code:
    .contact-form h3 {
        color: black;
    }
    Or, you could just give that particular H3 tag a unique ID, and target it directly...

    HTML:
    Code:
    <h3 id="contact_title">Contact Us</h3>
    CSS:
    Code:
    #contact_title {
        color: black;
    }
    Signature

    {{ DiscussionBoard.errors[9165876].message }}
  • Profile picture of the author outNabout
    i used a unique #id and it worked, thanks a lot though. i still have a long way learning CSS and specificity. i had tried the first one but it didn't work.

    .contact-form h3 { color: black; }
    Signature
    {{ DiscussionBoard.errors[9165947].message }}

Trending Topics