Reputation: 3017
I run into this a lot and it's fairly annoying. Does anyone know about this:
#content h5 {
color:red;
}
#next h5 {
color:blue;
}
When the markup looks like this:
<div id="content>
<h5>RED</h5>
<div id="next">
<h5>BLUE</h5>
</div>
</div>
The blue h5 will actually appear red, what gives?!
Upvotes: 0
Views: 54
Reputation: 382656
That's because of what is known as CSS Specificity, here is a good tutorial about it:
Upvotes: 0
Reputation: 1104
I had no problems with it. You do have a quote mark missing after content though. Below is what I tested with
<html>
<head>
<style>
#content h5 {
color:red;
}
#next h5 {
color:blue;
}
</style>
</head>
<body>
<div id="content">
<h5>RED</h5>
<div id="next">
<h5>BLUE</h5>
</div>
</div>
</body>
</html>
Upvotes: 2