OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE HTML> |
| 2 <style type="text/css"> |
| 3 :nth-child(2){color:red;} |
| 4 :nth-of-type(2){color:green;} |
| 5 p:nth-child(2n){color:blue;} |
| 6 div:nth-of-type(2n+1){color:yellow;} |
| 7 </style> |
| 8 <div> |
| 9 <p> |
| 10 This should be yellow, as this will inherit property of div. |
| 11 </p> |
| 12 <p> |
| 13 This should be blue, as this is even child of type p. |
| 14 </p> |
| 15 <p> |
| 16 This should be yellow, as this will inherit property of div. |
| 17 </p> |
| 18 <div> |
| 19 This should be yellow, as it odd child of its own type. |
| 20 </div> |
| 21 </div> |
| 22 <div> |
| 23 This should be green, as this is 2nd child of its own type. |
| 24 <p> |
| 25 This should be green, as this will inherit property of div. |
| 26 </p> |
| 27 <p> |
| 28 This should be blue, as this is the even child of div. |
| 29 </p> |
| 30 <p> |
| 31 This should be green, as this is the odd child of its own type. |
| 32 </p> |
| 33 <p> |
| 34 This should be blue, as this is the even child of paragraph. |
| 35 </p> |
| 36 </div> |
| 37 <div> |
| 38 This should be yellow, as this odd child of its own type. |
| 39 <p> |
| 40 This should be yellow,as this inherit property of div. |
| 41 </p> |
| 42 <span>This should be red,as this is the second child of div </span> |
| 43 <span>This should be green, as this is the second child of its own type </sp
an> |
| 44 <div> |
| 45 <span>This should be yellow,as this will inherit property of div i.e yel
low as odd of its own type <i>and </i> <i>this should be green and italic </i></
span> |
| 46 </div> |
| 47 </div> |
OLD | NEW |