stressed out
stressed out

Reputation: 552

CSS selector does not work correctly

I am using the code

footer h1,h2,h3,h4,h5,h6{
  color: #fff;
  margin: 10px auto;
}

to select all h tags that are inside footer. There's a HTML tag footer and if I'm not mistaken, my code should select only those h1,h2,h3,h4,h5,h6 tags that are inside a footer tag. But surprisingly, when I test my code, it selects all other h1,h2,h3,h4,h5,h6 tags that are outside of the footer tag as well!

How's that possible? Is there something I'm missing?

Upvotes: 0

Views: 67

Answers (2)

Bhoomi
Bhoomi

Reputation: 537

You have to write footer before all h. So that this css is implement to footer h1,h2 ... like below

footer h1, footer h2, footer h3, footer h4, footer h5, footer h6 {
  color: #fff;
  margin: 10px auto;
}

Upvotes: 2

Aymen bz
Aymen bz

Reputation: 388

footer h1, footer h2, footer h3, footer h4, footer h5, footer h6{
 color: #fff;
 margin: 10px auto;
}

Upvotes: 6

Related Questions