全屏
<!-- 
see adaptive version: https://codepen.io/argyleink/pen/oNmvVKj 
-->

<header class="hero">
  <img src="marvin-meyer-SYTO3xs06fU-unsplash.webp" alt="a wooden table is viewed top down where it is covered in laptops, coffee, and cables, appearing to be a table for lots of productivity.">
  <div>
    <h1>Expedita Voluptatibus</h1>
    <p>Vel rerum culpa consequuntur.</p>
    <br>
    <button>Nobis Loquere</button>
  </div>
</header>
@layer demo {
  .hero {
    display: grid;
    overflow: hidden;
    
    > * {
      grid-area: 1 / 1;
    }
    
    > img {
      block-size: 100dvh;
      width: 100%;
      object-fit: cover;
    }
    
    > div {
      z-index: 1;
      color: white;
      background: hsl(none none 0% / 95%);
      
      display: grid;
      gap: 1ch;
      place-content: center;
      place-items: center;
    }
  }
}

@layer demo.support {
  * {
    box-sizing: border-box;
    margin: 0;
  }

  html {
    block-size: 100%;
    color-scheme: light;
  }

  body {
    min-block-size: 100%;
    font-family: system-ui, sans-serif;
  }
  
  p {
    font-size: 1.25rem;
    font-weight: 300;
    line-height: 1.5;
    text-wrap: pretty;
  }
  
  img {
    max-width: 100%;
  }
  
  header h1 {
    font-size: 7vw;
  }
  
  button {
    background: deeppink;
    border: none;
    border-radius: 5ch;
    padding: 1ch 2.5ch;
    color: white;
    font-size: 1.25rem;
  }
}
返回