Created
November 22, 2012 15:58
-
-
Save lafikl/4131844 to your computer and use it in GitHub Desktop.
CSS specificity example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ul li a { | |
color: red; | |
} | |
.item { | |
color: blue; | |
} | |
/* item will win! */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul> | |
<li> <a href="#">Home</a> </li> | |
<li> <a class="item" href="#">About</a> </li> /* link color will be BLUE */ | |
<li> <a href="#">Foo</a> </li> | |
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ul#nav li a { | |
color: red; | |
} | |
.item { | |
color: blue; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul id="nav"> | |
<li> <a href="#">Home</a> </li> | |
<li> <a class="item" href="#">About</a> </li> /* color will be red */ | |
<li> <a href="#">Foo</a> </li> | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment