Answers for "css force image size"

2

css keep image ratio

img {
  object-fit: cover;
  width: 100px;
  height:100px;
}
Posted by: Guest on November-03-2020
0

force image no resize css

<!-- See here for demo: https://codepen.io/blairwadman/pen/GJZpmM -->
<div class="container">
  <div class="image">
    <img src="http://placehold.it/100x100" width="100" height="100" >
  </div>
  <div class="info">
    <p>Temporibus luctus inventore! Ornare adipisicing occaecati sunt leo optio porta rhoncus venenatis illum, consequat vulputate, ab. Tenetur velit porta pariatur.</p>
  </div>
</div>
<style>
  .container {
    display: flex;
} 
  img {
  width: 100%;
}

.image {
    flex-shrink: 0;
}
</style>
Posted by: Guest on August-20-2021

Browse Popular Code Answers by Language