×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: CSS
Posted by: Bradley Train
Added: Aug 7, 2014 2:13 PM
Views: 15
Tags: no tags
1)You can also select direct children
2)siblings
3)The first child of an element:
  1. body h1 {
  2.     # this matches any h1 element inside any other element inside
  3.     # the body
  4. }
  5.  
  6.  
  7. 1)    body > h1 {
  8.     # only h1 that is the direct child of body will match
  9. }
  10.  
  11. 2)    h1 + h2 {
  12.     # only h2 that comes immediately after h1 will match
  13. }
  14.  
  15. 3)     ul li:first-child {
  16.     # only matches the first li item
  17. }
  18.  
  19.