Set the background color of <p> elements, that are the first child of any element, to "pink". - HTML CSS CSS

HTML CSS examples for CSS:Quiz

Description

Set the background color of <p> elements, that are the first child of any element, to "pink".

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
p:first-child {<!--  ww  w  .j  a va 2 s .  c o m-->
    background-color: pink;
}
</style>
</head>
<body>

<p>This is a paragraph.</p>
<p>This is also a paragraph</p>

</body>
</html>

Related Tutorials