I'm working with a client whose site features photos with a graphical "sketch" border effect like this:
Normally these borders are simply included in the image file itself, but in this case, that's not going to work.
We're working on creating an image carousel that dynamically pulls in images from Twitter and Instagram, and we want to emulate the border effect. The site is responsive (using Bootstrap 2.3.2), so the border effect will need to scale as the image scales.
My initial thought was to use the border as a background and overlay the image like in this JSFiddle.
HTML:
<div class="outer">
<div class="inner">
<img src="img.png" />
</div><!-- /inner -->
</div><!-- /outer -->
CSS:
.inner {
width: 80%;
height: 80%;
display: block;
position: relative;
padding: 10%;
}
.inner:after {
background: url(http://i.imgur.com/JdA1v7i.png) no-repeat;
background-size: 100%;
width: 100%;
height: 100%;
top: 0;
left: 0;
position: absolute;
z-index: -1;
content:"";
}
.inner img {
max-width: 100%;
}
However, they want the border to be exactly flush with the image, and that won't happen using percents, since they don't divide evenly.
Any suggestions on how to go about creating this effect, making it responsive, and keeping the border flush with the inner image?