I'm looking to implement a hover hide effect. Check out my inspiration on CodePen
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
background-color: #123456;
}
#object {
background-color: cornsilk;
border: #333 3px solid;
margin: 20px auto;
padding: 20px;
position: relative;
width: 750px
}
#spoiler {
background-color: blue;
bottom: 0;
left: 0;
position: absolute;
right: 0;
top: 0;
transition: 0.3s opacity linear;
z-index: 5;
}
#spoiler:hover {
opacity: 0;
}
#big {
background-color: green;
color: black;
display: flex;
justify-content: center;
left: 0;
position: absolute;
right: 0;
text-align: center;
/* top: 0; */
z-index: 20;
}
<div id="object">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Beatae aperiam praesentium commodi optio ab saepe deserunt ullam et sequi doloremque consectetur hic laudantium inventore dignissimos, placeat modi nobis est nostrum.</p>
<div id="spoiler"></div>
<p id="big">Hover to show</p>
</div>
I'm trying to figure out how to vertically center the text "hover to show", any solutions?