FrontEnd.ro logo
Proprietatea "aspect-ratio"
<style>
  .grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  img {
    width: 100%;
  }

  .landscape-image {
    aspect-ratio: 1920/1080;
  }

  .portrait-image {
    aspect-ratio: 1080/1920;
  }
</style>
<h1> Aspect Ratio Gallery </h1>

<div class="grid">
  <img class="landscape-image" src="https://picsum.photos/1920/1080?random=1" alt="random 1" />
  <img class="portrait-image" src="https://picsum.photos/1080/1920?random=2" alt="random 2" />
  <img class="landscape-image" src="https://picsum.photos/1920/1080?random=3" alt="random 3" />
  <img class="portrait-image" src="https://picsum.photos/1080/1920?random=4" alt="random 4" />
  <img class="landscape-image" src="https://picsum.photos/1920/1080?random=5" alt="random 5" />
  <img class="portrait-image" src="https://picsum.photos/1080/1920?random=6" alt="random 6" />
</div>
<p>
  Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
  aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
  Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
  occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>