I was struggling a lot with getting my images to fit inside their parent element. In order to ask a better StackOverflow question, I decided to makde a codepen, but when I did that, the issue was solved? it's still not solved when I run a local server though. Can anyone explain this?
Outer div:
.img-holder{
opacity: .5;
left: 50%;
transform: translateX(-50%);
pointer-events: none;
position: relative;
max-width: 80vw;
display: block;
max-height: 80vh;
}
inside image:
img {
left: 50%;
transform: translateX(-50%);
position: relative;
max-height: 80vh;
}