For a project exercise using bootstrap, I'm working on recreating a page that can be found here: https://codepen.io/freeCodeCamp/full/NNvBQW
I've hit a roadblock in trying to put a border around the image. Here's the code I have so far: https://codepen.io/krassheit/pen/mxmdWG?editors=1100
HTML
<div class="container">
<div class="row" id="mainbox">
<div class="col-xl">
<h1 class="text-center">Dr. Norman Borlaug</h1>
<h2 class="text-center"><em>The man who saved a billion lives</em></h2>
<div id="test">
</div>
<figure class="figure mx-auto d-block image-box">
<img src="https://c2.staticflickr.com/4/3689/10613180113_fdf7bcd316_b.jpg" class="img-fluid mx-auto d-block" alt="Placeholder">
<figcaption class="figure-caption text-center"> Dr. Norman Borlaug, third from left, trains biologists in Mexico on how to increase wheat yields - part of his life-long war on hunger.</figcaption>
</figure>
</div>
</div>
</div>
CSS
body {background-color: gray;}
#mainbox {
background-color: #eed2ee;
}
.image-box{
padding: 2px 2px 2px 2px;
background-color: red;
margin-left: 100px;
}
But I am encountering an issue with the border expanding too wide when the window size is increased. Only by resizing the window smaller than the native picture size do the borders adjust correctly to the intended padding. Attached are screenshots for reference: