Boa tarde pessoal! Tudo bem?
Estava exercitando o degradê e não entendi o seguinte:
Por quê o elemento p
, da primeira <div>
pega o CSS aplicado somente na segunda <div>
?
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="gradient__one">
<h1>Gradient</h1>
<p>
background: linear-gradient(90deg, orange, blue);
</p>
</div>
<div class="gradient__two">
<h2>Gradient</h2>
<p>
background: linear-gradient(90deg, orange 50%, blue, black);
</p>
</div>
</body>
</html>
CSS
.gradient__one {
height: 25vh;
background: linear-gradient(90deg, orange, blue);
display: flex;
flex-direction: column;
justify-content:center;
align-items: center;
}
.gradient__one h1, p {
margin: 0;
}
.gradient__two {
height: 25vh;
background: linear-gradient(90deg, orange 50%, blue, black);
display: flex;
flex-direction: column;
justify-content:center;
align-items: center;
}
.gradient__two h2, p {
margin: 0;
background: linear-gradient(#cccccc, #E1E1);
padding: 3px 10px;
border-radius:3px;
}