<section class="flex">
  <div>
    <article>
      <h2>This is my main title </h2>
      <img src="https://images.unsplash.com/photo-1589225529399-8705282f98e2?crop=entropy&cs=srgb&fm=jpg&ixid=M3wzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2OTQyNTE5ODZ8&ixlib=rb-4.0.3&q=85" alt="" />
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras convallis sodales erat vel accumsan. Nam eget massa nec sem vulputate ullamcorper vel quis justo. Duis rhoncus tempor tempus.</p>
    </article>
  </div>
  <div>
    <article>
      <h2>This is my main title </h2>
      <img src="https://images.unsplash.com/photo-1484950763426-56b5bf172dbb?crop=entropy&cs=srgb&fm=jpg&ixid=M3wzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2OTQyNTE5ODZ8&ixlib=rb-4.0.3&q=85" alt="" />
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras convallis sodales erat vel accumsan. Nam eget massa nec sem vulputate ullamcorper vel quis justo. Duis rhoncus tempor tempus.</p>
    </article>
  </div>
  <div>
    <article>
      <h2>This is my main title </h2>
      <img src="https://images.unsplash.com/photo-1446776811953-b23d57bd21aa?crop=entropy&cs=srgb&fm=jpg&ixid=M3wzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2OTQyNTIwMjN8&ixlib=rb-4.0.3&q=85" alt="" />
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras convallis sodales erat vel accumsan. Nam eget massa nec sem vulputate ullamcorper vel quis justo. Duis rhoncus tempor tempus.</p>
    </article>
  </div>
  <div>
    <article>
      <h2>This is my main title </h2>
      <img src="https://images.unsplash.com/photo-1516339901601-2e1b62dc0c45?crop=entropy&cs=srgb&fm=jpg&ixid=M3wzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2OTQyNTIwNDh8&ixlib=rb-4.0.3&q=85" alt="" />
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras convallis sodales erat vel accumsan. Nam eget massa nec sem vulputate ullamcorper vel quis justo. Duis rhoncus tempor tempus.</p>
    </article>
  </div>
  <div>
    <article>
      <h2>This is my main title </h2>
      <img src="https://images.unsplash.com/photo-1564053489984-317bbd824340?crop=entropy&cs=srgb&fm=jpg&ixid=M3wzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2OTQyNTIwNDh8&ixlib=rb-4.0.3&q=85" alt="" />
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras convallis sodales erat vel accumsan. Nam eget massa nec sem vulputate ullamcorper vel quis justo. Duis rhoncus tempor tempus.</p>
    </article>
  </div>
</section>
@layer base-styles, theme, layout, cards;

@layer theme {
  :root {
    --layout-column-min: 40ch;
    --layout-gap: 3vmax;
  }
}

@layer layout {
  .grid {
    --grid-min: var(--layout-column-min);
    --grid-gap: var(--layout-gap);
    display: grid;
    grid-template-columns: repeat(
      auto-fit,
      minmax(min(var(--grid-min), 100%), 1fr)
    );
    gap: var(--grid-gap);
  }
  .flex {
    --flex-min: var(--layout-column-min);
    --flex-gap: var(--layout-gap);
    display: flex;
    flex-wrap: wrap;
    gap: var(--flex-gap);
    > * {
      flex: 1 1 var(--flex-min);
    }
  }

  :is(.grid, .flex) > * {
    container: var(--grid-item-container, grid-item) / inline-size;
  }

  /* just adding a section max width */
  section {
    width: 100%;
    max-width: 1800px;
    margin-inline: auto;
  }
}

@layer cards {
  article {
    padding: 1.2rem;
    border-radius: 0.5rem;

    background-image: linear-gradient(to top right, #ed00ff 0%, #6000ff 100%);
    color: white;
    @supports (color: color-mix(in oklab, red, tan)) {
      background-image: linear-gradient(
        to top right in oklab,
        oklch(73% 0.5 302) 0%,
        oklch(57% 0.39 276) 100%
      );
    }
    border: 0.3rem solid #6000ff;
    box-shadow: rgba(0, 0, 0, 0.19) 0px 10px 20px,
      rgba(0, 0, 0, 0.23) 0px 6px 6px;
    & img {
      aspect-ratio: 16 / 9;
      object-fit: cover;
      margin-block: 0 1rem;
      border-radius: 0.5rem;
    }
    & p {
      margin-block: 0;
    }
  }

  @container (min-width: 700px) {
    article {
      display: grid;
      grid-template-columns: 1fr 2fr;
      grid-row: auto / span 3;
      gap: 20px;
      & h2 {
        grid-column: 1 / 3;
        margin-block: 0;
      }
      & img {
        grid-row: auto / span 2;
      }
    }
  }
}

@layer base-styles {
  @import url("https://fonts.googleapis.com/css2?family=Lato:wght@300&family=Work+Sans:wght@500&display=swap");
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }
  body {
    margin: 0;
    padding: 5vw;
    display: flex;
    flex-direction: column;
    align-content: center;
    justify-content: center;
    min-height: 100vh;
    font-family: "Lato", sans-serif;
    font-weight: 300;
    font-size: 1.2rem;
    line-height: 1.6;
    background-image: radial-gradient(
      farthest-corner circle at 100% 0%,
      #00009e 0%,
      #27006b 100%
    );
    @supports (color: color-mix(in oklab, red, tan)) {
      background-image: radial-gradient(
        farthest-corner circle at 100% 0% in oklab,
        oklch(22% 0.4 222) 0%,
        oklch(0% 0.5 313) 100%
      );
    }
  }
  img {
    max-width: 100%;
    border: none;
  }
  h2 {
    font-family: "Work Sans", sans-serif;
    font-size: 2rem;
    font-weight: 500;
    line-height: 1.2;
    margin-block: 0 1.4rem;
  }
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.