In my website, I have created a div tag, and I have set its background to a image, and whenever the image is hovered, the color darkens. Now I also want text to appear horizontally and vertically centered when the image is hovered. I tried to add text, but the text does not even appear on the image.
Here is my HTML:
<div id="countries-hitched-div">
<h1> Places Hitched </h1>
<div id="first" class="image">
<h1 id="first-text"> India </h1>
<div class="overlay"></div>
</div>
</div>
Here is my CSS:
#first {
background: url('Images/Home Page/first-quote-image-final.jpg');
position: relative;
}
.image {
width: 500px;
height: 500px;
position:relative;
}
.image:hover > .overlay {
width:100%;
height:100%;
position:absolute;
background-color:#000;
opacity:0.5;
}
#first-text {
position: absolute;
color: black
}