Skip to content

Instantly share code, notes, and snippets.

@patsma
Created January 16, 2019 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patsma/f8f6be3e46c12f1b71de55f11954f202 to your computer and use it in GitHub Desktop.
Save patsma/f8f6be3e46c12f1b71de55f11954f202 to your computer and use it in GitHub Desktop.
<div class="image-container-block">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/65984/photo-1413752567787-baa02dde3c65.jpg" alt="">
<div class="inner-image-block">
<div class="image-animate-border"></div>
</div>
</div>
<style>
</style>
//IMAGE HOVER OVERLAY START
.image-container-block {
display: inline-block;
position: relative;
&:hover {
.inner-image-block:before,
.image-animate-border:after {
height: 100%;
}
.inner-image-block:after,
.image-animate-border:before {
width: 100%;
}
}
img {
display: block;
max-width: 100%;
}
}
.image-animate-border:before,
.inner-image-block:after {
height: 1px;
transition: width 0.75s ease;
width: 0;
}
.image-animate-border:after,
.inner-image-block:before {
height: 0;
transition: height 0.75s ease;
width: 1px;
}
.inner-image-block:before,
.inner-image-block:after,
.image-animate-border:before,
.image-animate-border:after {
background-color: #fff;
content: "";
display: block;
position: absolute;
}
.inner-image-block {
width: 95%;
height: 95%;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
&:before {
bottom: 0;
left: 0;
}
&:after {
bottom: 0;
right: 0;
}
}
.image-animate-border {
position: relative;
width: 100%;
height: 100%;
&:before {
top: 0;
left: 0;
}
&:after {
top: 0;
right: 0;
}
}
//IMAGE HOVER OVERLAY END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment