0
1.4kviews
Make a stylesheet in which background color of alternate paragraph should be different.
1 Answer
0
20views

Alternate Paragraph colors:

<!DOCTYPE html>
<html>
<head>
<title>Alternate Paragraph Colors</title>
<style>
p:nth-of-type(odd)
{
background:yellow;
}
p:nth-of-type(even)
{
background:pink;
}
</style>
</head>
<body>
<center><h1>Alternate Paragraph Colors</h1></center>
<p>The First Paragraph</p>
<p>The Second Paragraph</p>
<p>The Third Paragraph</p>
<p>The Fourth Paragraph</p>
<p>The Fifth Paragraph</p>
<p>The Sixth Paragraph</p>
<p>The Seventh Paragraph</p>
<p>The Eight Paragraph</p>
<p>The Ninth Paragraph</p>
<p>The Tenth Paragraph</p>
</body>
</html>
Please log in to add an answer.