Prev Demo
CSS3
>
First-Child Selector
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <style> b:first-child { color: red; } </style> <b>This is 'b' element but it is not the first child.</b> <br /> <div> <b>This is the 'b' element and it is First child of parent div.</b> </div> <p> <b>This is the first child of the parent 'p' and it is 'b' element.</b><br /> <b>This is the second child of the parent 'p' and it is also 'b' element.</b> </p> <br /> <div> <b>This is the first child of the parent div in'b' element.</b><br /> <b>This is the second child of the parent div in 'b' element.</b> <p>This is the first child of the parent div in 'p' element.</p> <p>This is the second child of the parent div in 'p' element.</p> </div> <br /> <br/> <strong>It will not work in IE9.</strong> </body> </html>
Note: We DO NOT save your trial code in our database.
Output