I'm trying to style these two <div>
's by using nth-child, however, when I add the psuedo-class: :nth-child
to my <p>
it changes both paragraphs instead of one.
Here's my website:
body {
margin: 0 auto;
}
div {
height: 200px;
width: 250px;
float: left;
border: 1px solid black;
}
p {
padding-left: 20px;
margin: 0;
font-size: 18px;
font-family: calibri;
}
p:nth-child(1) {
background: yellow;
}
<html lang="pl">
<head>
<title>Budowa strony</title>
<meta charset="utf-8">
<meta name="PAI 12"
content="Opis strony">
<link rel="stylesheet" href="style2.css">
</head>
<body>
<div>
<p>• tekst </p>
<p>• tekst </p>
<p>• tekst </p>
<p>• tekst </p>
<p>• tekst </p>
<p>• tekst </p>
<p>• tekst </p>
<p>• tekst </p>
<p>• tekst </p>
</div>
<div>
<p>• tekst </p>
<p>• tekst </p>
<p>• tekst </p>
<p>• tekst </p>
<p>• tekst </p>
<p>• tekst </p>
<p>• tekst </p>
<p>• tekst </p>
<p>• tekst </p>
</div>
</body>
</html>
` in the `