I'm facing a bit of difficulty with a task. I need to add a border around an element within an image (I can't insert an image due to low reputation), and this border should match the width and height of the element exactly. It also needs to be responsive. I tried using Bootstrap media screen rules, but encountered issues with the width at certain resolutions. Here is the code. Thank you.
<div class="parent">
<img />
<span class="makeBorder"></span>
</div>
Here is the CSS:
.parent {
position: relative;
}
.makeBorder {
position: absolute;
top: 15px;
left: 23px;
border: 2px solid red;
width: 83%;
height: 83%;
}
How I finally resolved it:
<div class="customClass"><img /></div>
.customClass{outline:1px solid red;outline-offset:-18px;}