Your .image-land-div
has a width of 25%, which is 25% width of the .personnal-work
plus a margin-left:1%
. So when you calculate the space take by .image-land-div
is 26% of .personnal-work
ie, 25% width + 1% margin-left + 1px border on each side. So when you add up the 4 .image-land-div
the total width exceeds 100%. To prevent the last image from dropping down change the styles as below
.image-land-div{
width: 24%;
max-width: 194px;
margin-left: 1%;
float: left;
display: inline;
border: 1px solid white;
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
-moz-box-sizing: border-box; /* Firefox */
box-sizing: border-box; /* Opera/IE 8+ */
}
To solve the second issue, ie the space between the image and border on hover, add a vertical-align
style to the image. Use the below styles for it.
.image-land{
width: 100%;
display: inline;
height: 100%;
vertical-align:middle;
}
Check this DEMO