If you want to create a cool inset effect using CSS, you can achieve this by applying a box-shadow. Here is an example:
Check out the code example here
HTML Markup:
<figure>
<img src="http://lorempixel.com/300/300/nature/" />
</figure>
CSS Styling:
figure {
display: inline-block;
box-shadow: inset 0 0 0 10px rgba(255, 255, 255, .4);
}
figure img {
display: block;
position: relative;
z-index: -1;
}
If you want to add a hover effect to the inset shadow, you can use CSS transitions like this:
figure {
display: inline-block;
box-shadow: inset 0 0 0 10px rgba(255,255,255, 0);
transition: all .5s 0s;
}
figure:hover {
box-shadow: inset 0 0 0 10px rgba(255,255,255, .4);
}
figure img {
display: block;
position: relative;
z-index: -1;
}
The CSS code defines a white border with 40% opacity. The image has a negative z-index to ensure the inset shadow on the figure element is visible. Feel free to customize the wrapper element to suit your needs.
See the result: