CSS Style Selectors

 

ATTENTION: THIS PAGE IS Valid HTML 5 AND IS BEST VIEWED WITH HTML 5 - Please upgrade your browser or download one of the HTML 5 compatible browsers such as Mozilla Firefox, Chrome, Opera or IE 9 (March 14, 2011 or later). For more information see HTML 5 browsers.


If you find this helpful, please click the Google +1 Button to the left, if it is white, to make it turn blue. Thank you! (It also helps find this page again more easily.) If you don't see the +1 button, you may need to Join the +1 Experiment.


PDF mobile

CSS Style Selectors

Class Selector
span.class-name, ... {
   property: value;
   ...
}
<span class="class-name">phrasing content<span>
id Selector
span#id-value, ... {
   property: value;
   ...
}
<span id="id-value">phrasing content<span>
Pseudo-class Selector
span:pseudo-class-name, ... {
   property: value;
   ...
}
Context Selector
context-selector selector, ... {
   property: value;
   ...
}

div.context-class-name span.class-name, ... {
   ...
}
<div class="context-class-name">
   <span class="class-name">phrasing content<span>
</div>

Valid HTML 5