Question: Make a style sheet in which background color of alternate paragraph should be different.
1

Subject: Advanced Internet Technology

Topic: Responsive web design with HTML5 and CSS3

Difficulty: Low

ait(26) • 2.0k views
ADD COMMENTlink
modified 17 months ago  • written 19 months ago by gravatar for yamini_patil_28 yamini_patil_28690
2
<!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>
ADD COMMENTlink
written 17 months ago by gravatar for yamini_patil_28 yamini_patil_28690
Please log in to add an answer.