Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Css set a property for h2 to h6 for a specific class

Tags:

html

css

I have a div, inside different <h> tags.

I would like to apply some formatting to ALL <h> tags inside specifically to any with class cnt ONLY.

At the moment I'm using the following CSS without success... Any ideas what I'm doing wrong and how to fix it?

<div class="cnt">
    <h1>Some Text.</h1>
    <h2>Some Text.</h2>
    <h3>Some Text.</h3>
    <h4>Some Text.</h4>
    <h5>Some Text.</h5>
    <h6>Some Text.</h6>
</div>


    h2 h3 h4 h5 h6 .cnt 
    {
        font-size:16px;
        font-weight:700;
    }
like image 844
GibboK Avatar asked Sep 19 '11 09:09

GibboK


1 Answers

.cnt h2, .cnt h3, .cnt h4, .cnt h5, .cnt h6 {
    font-size:16px;
    font-weight:700;
}

read up on css specificity

like image 114
Ross Avatar answered Oct 18 '22 22:10

Ross