I followed this problem : CSS image resize percentage of itself?
But in my case, nothing works.
I have 4 images I would like to fit inside a container. I've tried putting them in another div container and then adjusting their width in %, but it keeps adjusting to the width of the parent.
the solution I have is to keep playing with the width % of the img to get what I want. And I made them as flex items.
Is there a way to adjust the size of the images based on their own size?
What I want is, if I enter img { width : 50%;} I want it to be 50% if the image. Not the container. I've tried this way in my code, but not successful.
I can Imagine that having a fixed width container would make it work, but how about this width : max-container or fit-content?Doesn't seem to make what I thought.
.terms-of-service h2 {
text-align: left;
}
.terms-of-service p {
margin: 5px;
padding-left: 5px;
}
.small-logos {
display: flex;
width: max-content;
justify-content: space-evenly;
}
.small-logos img {
width: 15%;
}
<div class="terms-of-service col-content">
<h2>Terms of Service</h2>
<p>This site uses cookies. By continuing to use this site you are agreeing to our use of cookies. Please refer to <a href="#">Google's Privacy Terms</a> and <a href="#">Terms of Service</a> to see how cookies are used.</p>
<div class="small-logos"><img src="https://www.sabico.com/wp-content/uploads/2012/12/slocaliza2.jpg" alt="BBB"><img src="https://www.sabico.com/wp-content/uploads/2012/12/slocaliza2.jpg" alt="25y"><img src="https://www.sabico.com/wp-content/uploads/2012/12/slocaliza2.jpg" alt="green"><img src="https://www.sabico.com/wp-content/uploads/2012/12/slocaliza2.jpg"
alt="Env"></div>
</div>