HTML file: | Displayed by browser: |
---|---|
<style>
<body>
|
This is a headingThe first paragraph. The second paragraph. The third paragraph. The fourth paragraph. |
The heading is the first child of the parent (body) element, while the highlighted paragraph is the second child. Use the :nth-of-type() selector to select the element that is the nth child, of a particular type, of its parent. Note: Internet Explorer 8 and earlier versions do not support the :nth-child() selector.