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


Tags: css

Problem :

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 :)



Solution :

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;
}

    CSS Howto..

    How to assign css for prettify(syntax highlighter)

    How to apply customized css to SSRS report

    How can I wrap a page with a centered DIV?

    How to create CSS/JavaScript circles grid

    css - how to add another div above one with 2 colums layout?

    How can I apply an existing CSS class style to a dynamically created div?

    How to slide down to show content of DIV using CSS/jQuery?

    How to make a fully responsive web page [closed]

    CSS html : non-standard picture frame: how to imlement with CSS and HTML?

    How to set CSS class to Button control using Session value in design page

    JavaScript / Jquery : How to find line-through words

    How do I get my divs to ease in right after eachother on page load?

    How to display a list in horizontal groups of li elements?

    HTML/ CSS: A href exceeds linking image - how to avoid?

    How to integrate Thread and

    How to CSS: select element based on inner HTML

    How to set background url for css files in thymeleaf?

    How to draw a line with css and show text or image on it

    How to Link to Images in CSS file in RoR 3.2 Project?

    How to apply nested css using jQuery?

    How do I make a absolute positioned div have a width equal to it's parent minus some margin

    How to change value of class in another class?

    how to get rid of the border-bottom by css?

    why is the space (shown in image) is added below when using vertical-align? How to fix it?

    CSS: How to center a bottom-fixed menu

    Setting a revealing onhover behaviour for multiple elements-pairs with only CSS - how come this works?

    HTML - How do I insert a tag into each line of a
     block without hard coding?

    How to make google maps fit the mobile device screen

    How can I make sure that the footer will always be on the bottom of the last page when printing out?

    How to add css to jquery backstretch?