After or before :-
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>After and before pseudo selector</title>
<link rel="preconnect" href="https://fonts.gstatic.com"
crossorigin>
</head>
<style>
body{
background-color: black;
color: white;
padding: 0px;
margin: 0px;
font-family: 'PT Sans', sans-serif;
}
nav::before{
content: "";
background:
url("https://source.unsplash.com/random/?city,night") no-repeat center
center/cover;
position: absolute;
height: 100%;
width: 100%;
z-index: -1;
opacity: 0.3;
top: 0px;
left: 0px;
}
.navbar{
display: flex;
}
.navigation{
display: flex;
flex-direction: row;
}
.navigation li{
padding: 12px 20px;
list-style: none;
cursor: pointer;
}
/* after psedo selector use the after content install insert in the
item */
/* before psedo selector use the before content install insert in
the item */
section{
font-family: 'PT Sans', sans-serif;
border: 1px solid white;
display: flex;
margin: 12px 52px;
flex-direction: column;
align-items: center;
justify-content: center;
height: 233px;
font-size: 20px;
}
h1{
text-align: center;
font-size: 10rem;
}
p{
text-align: center;
}
</style>
<body>
<nav>
<div class="navbar">
<ul class="navigation">
<li class="item" id="item1">Home</li>
<li class="item" id="item2">About</li>
<li class="item" id="item3">Services</li>
<li class="item" id="item4">Contact</li>
</ul>
</div>
</nav>
<section>
<h2>This is the first heading here </h2>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit.
Iste doloremque quia recusandae distinctio quis, eos id deleniti
repellat esse accusamus quos molestias adipisci cum ducimus quam culpa
veniam necessitatibus eius!</p>
</section>
</body>
</html>
Thanks you for commenting your questions. I will see question and respond you.