0
5.0kviews
Make a style sheet in which background color of alternate paragraph should be different.

Subject: Advanced Internet Technology

Topic: Responsive web design with HTML5 and CSS3

Difficulty: Low

1 Answer
2
179views
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>paragraph</title>
<style>
    p:nth-child(odd)
{
background:#333;
color: #fff;
padding: 5px;
}
p:nth-child(even)
{
background:#fff;
padding: 5px;
}
</style>
</head>
<body>
<div class="para"><h1>alternate paragrpah color</h1>
<p>sdfasdf </p>
<p>asdfasdf</p>
<p>asdfasdf</p>
<p>asdfasdf</p>
<p>asdfasdf</p>
<p>asdfasdf</p>
<p>sadfasdf</p>
<p>asdfasdf</p>
<p>asdfasdf</p>
<p>asdfasdf</p>
</div>
</body>
</html>
Please log in to add an answer.