I have a div that has 2 children: an image and 2 lines of text. I add border:1px solid #grey;
on hover to the div but for some reason, it also moves the children inside the div as well.
Here is my example: http://jsfiddle.net/pmn8y4hd/
.candidates{
width:100%;
height: auto;
background: #FFFFFF;
border: 1px solid #EAEAEA;
padding: 40px 0 45px 0;
margin: 0 0 12px 0;
}
.candidate{
width:310px;
margin: 0 auto 10px;
height: auto;
padding: 16px 15px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.candidate:hover{
background: #FFFDFC;
border: 1px solid #EAEAEA;
border-radius: 6px;
}
.candidate-details{
height: 48px;
display: flex;
flex-direction: column;
justify-content: center;
}
.candidate-image{
width:48px;
height: 48px;
float:left;
margin: 0 10px 0 0;
}
.candidate-image img{
width:100%;
}
<div class="candidates">
<div class="candidate">
<div class="candidate-image">
<img src="images/logo.png" alt="" title="" />
</div><!-- candidate-image -->
<div class="candidate-details">
<h3>Johnny Appleseed</h3>
<h4>Space Monkey at NASA</h4>
</div><!-- candidate-details -->
</div><!-- candidate -->
</div><!-- candidates -->
I have added box-sizing: border-box;
but it does do anything.