H.Harrison1993
H.Harrison1993

Reputation: 55

How to put headings into classes on HTML and CSS

div.countries {
  color: blue;
  font-family: Arial;
}
<div class="countries">
  <h2>Mexico</h2>

</div>

<div class="countries">
  <h3>Brasil</h3>

</div>

Can anyone tell me whats wrong with the code above in CSS. In the HTML section the headings are written as:

<h2>
Mexico
</h2> 

and

<h3>
Brasil
</h3>

But the h2 and h3 still won't appear as blue or in Arial as I want them to. I can't see what's wrong but I am pretty much a complete amateur at this and just trying to learn. Hope someone can help me :) If you want to to specify anything else or need more information, please ask.

Upvotes: 1

Views: 53

Answers (2)

Scott Murphy
Scott Murphy

Reputation: 136

h2, h3 {
   color: blue;
   font-family: Arial;
}

Upvotes: 0

Syden
Syden

Reputation: 8625

It works fine, most likely something overrides them, you could try to impact deeper and maybe it will override them back:

div.countries>h2, div.countries>h3 {
  color: blue;
  font-family: Arial;
}

Upvotes: 2

Related Questions