I am trying to make the div size the exact dimensions as the image inside of it. I need this done because I am trying to put a box-shadow that borders the image, and with my current code, the box shadow borders the div surrounding the image. This is causing the box-shadow to be offset from the image. Below is my .css and .html code:
.css:
.image__container--one {
display: flex;
flex-direction: row;
margin-top: 2rem;
}
#image-one {
height: 60rem;
width: auto;
margin-right: 5rem;
display: block;
transition: all 1s ease;
}
#image-two {
height: auto;
width: 60rem;
align-self: flex-start;
margin-left: 5rem;
box-shadow: 2px 2px 20px 10px rgb(43, 43, 43);
}
.img-wrapper {
overflow: hidden;
box-shadow: 2px 2px 20px 10px rgb(43, 43, 43);
}
#image-one:hover {
transform: scale(1.1);
-ms-transform: scale(1.1);
-moz-transform: scale(1.1);
-webkit-transform: scale(1.1);
-o-transform: scale(1.1);
}
.html:
<body>
<main class="container">
<div class="container__main">
<div class="container__main--title">
<h1>John Doe Photography</h1>
</div>
<div class="image__container--one">
<div class="img-wrapper">
<img
src="/portfolio/vertical4.jpg"
alt="India culutre"
id="image-one"
/>
</div>
<img
src="/portfolio/horizontal2.jpg"
alt="Camel image"
id="image-two"
/>
</div>
</div>
</main>
</body>
