Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change just the css inside a DIV and not anywhere else?

Tags:

css

I have this code :

h1, h2, h3, h4{ 
    color: red;
}
.message_rouge h1, h2, h3, h4,{color: black;}

Why are ALL my headers black instead of just the ones inside "message_rouge" and the rest red?

Thanks :)

like image 511
Joel Avatar asked Jun 11 '12 01:06

Joel


2 Answers

Each line is it's own selector, but you're only specifying .message_rouge on the first one.

Use this instead:

.message_rouge h1, 
.mesage_rouge h2,
.mesage_rouge h3,
.mesage_rouge h4 {
    color: black;
}
like image 80
Marko Avatar answered Nov 14 '22 07:11

Marko


This is wrong

.message_rouge h1, h2, h3, h4,{color: black;}

This is right

.message_rouge h1,.message_rouge h2,.message_rouge h3,.message_rouge h4,{color: black;}
like image 45
Nicolás Torres Avatar answered Nov 14 '22 06:11

Nicolás Torres