<div class="container">
  <h1>Full-Bleed Layout Using CSS Grid</h1>
  <p>Oftentimes, we want to limit the width of an element relative to its parent, and at the same time, to make it dynamic. So having a base width or height with the ability to make it extend based on the available space.</p>
  <div class="full">
    <img src="https://picsum.photos/1920/300?random" alt="" width="1920" height="300">
  </div>
  <p>Oftentimes, we want to limit the width of an element relative to its parent, and at the same time, to make it dynamic. So having a base width or height with the ability to make it extend based on the available space.</p>
</div>
@import url("https://fonts.googleapis.com/css2?family=Exo:wght@600&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  width: 100vw;
  min-height: 100vh;
  font-family: "Exo", Arial, sans-serif;
  line-height: 1.5;
  background-color: #557;
  display: grid;
  grid-template-rows: 1fr auto;
  color: #fff;
  align-items: start;
  font-size: clamp(1rem, 1.2rem + 1vw, 1.25rem);
}

.form {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background-color: rgb(0 0 0 / 0.5);
  padding: 10px;
}

.container {
  --limit-max-container-width: 65ch;
  --limit-min-container-width: 23ch;
  --gutter: 1rem;
  display: grid;
  grid-template-columns:
    1fr minmax(
      min(var(--limit-min-container-width), 100% - var(--gutter) * 2),
      var(--limit-max-container-width)
    )
    1fr;
  gap: var(--gutter);
}

.container > * {
  grid-column: 2;
}

.container > .full {
  grid-column: 1 / -1;
}

.full img {
  display: block;
  max-width: 100%;
  height: auto;
  object-fit: cover;
  object-position: center;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.