first child selectorsExplanationFirst child selectors select a specified element if, and only if, it is the first element contained by its parent element. It doesn't matter what this parent element is. SyntaxThe first child selector has a syntax much like a pseudo-element selector (it's not a pseudo element however because while the first-line or the first-letter of an element are not actually HTML elements, the first-child is itself an HTML element). The syntax is a selector (commonly, but not necessarily a simple HTML element selector), followed by For example Consider the following situation
The On the other hand it will not select anything in the code below.
In this second example the table element is the first child. UseThink of the following scenario. We have each chapter of a book as a web page. Where the chapter is divided into sections, we have created a By way of example, the selector for the above selection of each paragraph when it is a first child would be Browser supportDetailed browser support information for this feature can be found in the full version of the Westciv CSS Guide, or in our CSS Browser Support Table. next: adjacent selectors(C)1997-2001 Western Civilisation Pty. Ltd. |