Created
April 7, 2012 23:02
-
-
Save rhatano/2332712 to your computer and use it in GitHub Desktop.
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
Well to do that, you simply combine the two types of selectors. | |
Say you had some HTML like this; | |
<h1>Example</h1> | |
<h1 class="first">This is my first heading</h1> | |
<p class="first"> This is my first paragraph</p> | |
<h2 class="second">This is my second heading</h2> | |
<p class="second"> This is my second paragraph</p> | |
.first { | |
[some css] /*This would style the elements with the class value "first"*/ | |
} | |
.second { | |
[some css] /*This would style the elements with the class value "second"*/ | |
} | |
However: | |
h1.first { | |
[some css] /*This would only style the h1 element with the class value "first" | |
} | |
This is useful because it allows you to be more specific in how you identify elements in your html, and also | |
allows your CSS to be shorter with less redundant code. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment