I have some thumbnails that I want to display text/dark transparency over on hover. The way they're set up, the HTML calls the image and the text block immediately below. CSS pulls the text block over the image and changes the opacity on hover.
This works fine in Chrome, Firefox, and Safari. However, on IE, it's keeping the text block immediately below the image.
Here is my HTML code. Please note that the shortcodes are functions I've created to pull the thumbnail images and text blocks from a database. Just consider them image and text elements.
Teambox calls out the image. Teamoverbox is the hover block. Teamtitleovertext is the actual text. Teamcontainer wraps the whole thing.
Here's the page source output. It's a grid of thumbnails, so I only grabbed one of them.
<div class="teamcontainer">
<div class="teambox">
<a href="/?team-member=dennis-rosario"><img alt="" class="attachment-full" src="/wp-content/uploads/2017/02/team_0006_dennis.jpg" />
<div class="teamoverbox"><div class="teamtitleovertext"> Dennis Rosario</div></div></a>
</div>
Here is my CSS.
#teamgrid img {
position: relative;
top: 0;
height: 150px;
width: 150px;
}
.teambox {
position: relative;
z-index: 1;
height: 150px;
width: 150px;
}
.teamoverbox {
height: 150px;
width: 150px;
position: relative;
z-index: 2;
top: -150px;
text-align: center;
display: table-cell;
vertical-align: middle;
opacity: 0;
background: rgba(0,0,0,0.5);
-webkit-transition: opacity 500ms;
-moz-transition: opacity 500ms;
-o-transition: opacity 500ms;
transition: opacity 500ms;
color: #fff;
text-transform: uppercase;
}
.teamoverbox:hover {
opacity: 1;
}