After @colandus suggested adding position: relative
and z-index
to the img
, it seems like that did the trick.
But it appears that things might be getting a bit too complicated. Why add position relative to the p
tag? That seems to be causing the issue...
If you simplify your HTML/CSS, you can achieve the desired result. Here's an example:
Here is the simplified HTML code with some divs removed:
<div class="insp">
<h3>Thomas Edison</h3>
<img src="http://www.placehold.it/250x150">
<p>Lorem Ipsum is s...</p>
</div>
And the simplified css with position: relative
removed from the p
tag:
.insp {
border: 2px solid black;
margin: 10px 0px;
padding:10px;
}
.insp h3 {
margin-top:0px;
background-color:#FFDE5C;
}
.insp img {
float:left;
border: 5px solid #FFDE5C;
height:150px;
margin: 0 20px 20px 0;
}
.insp img:hover {
border: 5px solid #ffffff;
}
.insp p {
margin: 40px 40px 40px 80px;
}
As shown in this example, the appearance is the same without any hover issues.