code_junkie

Understanding CSS selectors

Nov 14th, 2011
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #stories li a {color:red}
  2. .default li.expand a {color:green}
  3. li.expand a {color:blue}
  4.  
  5. <ul id="stories" class="default">
  6. <li>this is the end</li>
  7. <li class="expand">this is the end</li>
  8.  
  9. <div id="first-id">
  10. <div id="second-id">
  11. <div class="someclass">
  12.  
  13. </div>
  14. </div>
  15. </div>
  16.  
  17.  
  18. #first-id .someclass {}
  19.  
  20. .someclass {}
  21.  
  22. #second-id .someclass {}
  23.  
  24. .someclass { color:#f00 !important;}
  25.  
  26. <ul id="stories" class="default">
  27. <li>this is the end</li>
  28. <li class="expand">this is the end</li>
  29. </ul>
  30. <ul class="default">
  31. <li>this is the end</li>
  32. <li class="expand">this is the end</li>
  33. </ul>
  34. <ul>
  35. <li>this is the end</li>
  36. <li class="expand">this is the end</li>
  37. </ul>
Add Comment
Please, Sign In to add comment