13 June 2005 10:45
Eric's Archived Thoughts: Universal Child Replacement
by nhoizeythere is a way to simulate child selection without actually using the child combinator. The general pattern is to use a normal descendant selection in your first rule, and then “undo” the first rule with a second that has a universal selector in the middle. Suppose you want to boldface any p element that’s a child of a div, but no others. The solution:
div p {font-weight: bold;}
div * p {font-weight: normal;}
1
(1 marks)