I have two images that need to be at the bottom of a div and behind a gradient that needs to have the same rules both can be fixed with position: absolute; bottom: 0;
but it moves the images in front of the gradient
The reason for this approach is that I need the page to be responsive with different resolutions for PCs
Gradient CSS Code:
.gradient {
position: absolute;
bottom: 0;
background-image: linear-gradient(0deg, #000000, transparent);
width: 100%;
margin-top: 43.5%;
height: 13.8%;
}
Images CSS Code:
.images {
width: 95%;
margin: auto;
padding: 4% 0 0 0;
display: flex;
align-items: center;
justify-content: space-between;
position: absolute;
bottom: 0;
}
Html of the whole page:
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@200&display=swap" rel="stylesheet">
<link rel="stylesheet" href="styles.css">
<link rel="shortcut icon" href="icon.png">
<title>Creature Cult</title>
</head>
<body>
<div >
<div ></div>
<div >
<img src="banner.png" alt="logo" >
<ul>
<li><a href="#">About</a></li>
<li><a href="#">Team</a></li>
<li><a href="#">Socials</a></li>
</ul>
</div>
<div >
<img src="explore.png" alt="explore" >
</div>
<div >
<img src="arrow.png" alt="arrow" >
</div>
<div >
<img src="rabbit.png" alt="rabbit" >
<img src="penguin.png" alt="penguin" >
</div>
</div>
<div >
</div>
</body>
</html>
CodePudding user response:
Add a z-index
on .gradient
(z index 1) .images
(z index 0) in order to fix display layers order