<header class="header">
  <img src="https://assets.twicpics.com/videos/demo-twicpics/logo-white.png" alt="TwicPics logo" />
</header>
<main>

  <div class="twic-w squared">
    <img
         data-twic-src="image:cat_1x1.jpg"
         src="https://demo.twic.pics/v1/output=preview/image:cat_1x1.jpg"
         >
  </div>

  <div class="twic-w portrait">
    <img
         data-twic-src="image:cat_1x1.jpg"
         src="https://demo.twic.pics/v1/output=preview/image:cat_1x1.jpg"
         >
  </div>

  <div class="twic-w landscape">
    <img
         data-twic-src="image:cat_1x1.jpg"
         src="https://demo.twic.pics/v1/output=preview/image:cat_1x1.jpg"
         >
  </div>
  
   <div class="twic-w squared">
    <img class="contain"
         data-twic-src="image:cat_1x1.jpg"
         src="https://demo.twic.pics/v1/output=preview/image:cat_1x1.jpg"
         >
  </div>

  <div class="twic-w portrait">
    <img class="contain"
         data-twic-src="image:cat_1x1.jpg"
         src="https://demo.twic.pics/v1/output=preview/image:cat_1x1.jpg"
         >
  </div>

  <div class="twic-w landscape">
    <img class="contain"
         data-twic-src="image:cat_1x1.jpg"
         src="https://demo.twic.pics/v1/output=preview/image:cat_1x1.jpg"
         >
  </div>

</main>
<div>I Will Not CLS</div>

<!-- Installation of the TwicPics -->
<script src="https://demo.twic.pics/?v1" async defer></script>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Montserrat", sans-serif;
  color: #454446;
}

div{
  background-color : #1CFFA6;
}

main {
  padding: 2em;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  grid-gap: 1em;
}

img {
  display: block;
  object-fit: cover;
  width: 100%;
  height: 100%;
}

.contain {
  object-fit: contain;
}

@mixin aspect-ratio($width, $height) {
  position: relative;
  overflow: hidden;

  &:before {
    display: block;
    content: "";
    width: 100%;
    padding-top: ($height / $width) * 100%;
  }
  
  > img {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }
}


.twic-w {
  border: 10px solid red;
  width: 100%;
}

.squared{
  @include aspect-ratio(1, 1);
}

.landscape{
  @include aspect-ratio(3, 2);
}

.portrait{
  @include aspect-ratio(2, 3);
}



.header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 5px 0 8px 0;
  background-color: #9002ff;
  & img {
    width: 140px;
  }
}



View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.