Image and text Overlay using html and css
Image Overlapping
<!DOCTYPE html>
<html>
<head>
<style>
* {
box-sizing: border-box;
}
p {
font-size: 20px;
font-family: Arial, Helvetica, sans-serif;
color: #a97839;
}
h1 {text-align: center;
}
.container {
padding: 100px 30px;
width: 100%;
margin: 0 auto;
max-width: 800px;
}
.bgimage-stack {
position: relative;
width: 100%;
}
.image-stack__item--bottom {
position: absolute;
right: 0;
top: 0;
width: 80%;
z-index: -1;
}
.image-stack__item--top {
padding-top: 68px;
padding-right: 24%;
width:100%;
}
img {
width: 50%;
display: block;
}
</style>
</head>
<body>
<class="container">
<h1>Image overlapping</h1>
<div class="bgimage-stack">
<div class="bgimage-stack__item image-stack__item--bottom">
<img src="images/bgnature.jpeg" alt="">
</div>
<div class="bgimage-stack__item image-stack__item--top">
<img src="images/small1.jpeg" alt="">
</div>
</div>
<p>.</p>
</div>
</body>
</html>
Overlapping Image by Mouse Hover
<!DOCTYPE html>
<head>
<style>
* {box-sizing: border-box;}
.container {
position: relative;
width: 50%;
max-width: 300px;
}
.image {
display: block;
width: 100%;
height: auto;
}
.overlay {
position: absolute;
bottom: 0;
background: rgb(0, 0, 0);
background: rgba(0, 0, 0, 0.5);
color: #f1f1f1;
width: 100%;
transition: .5s ease;
opacity:0;
color: white;
font-size: 30px;
padding: 20px;
text-align: center;
}
.container:hover .overlay {
opacity: 1;
}
</style>
</head>
<body>
<class="container">
<h2>Image Overlay </h2>
<p>Hover over the image to see the effect.</p>
<div class="container">
<img src="images/bgnature.jpeg" alt="" class="image">
<div class="overlay"><img src="images/small1.jpeg" alt="" class="image"></div>
</div>
</body>
</html>
Keywords: