Container-Query-Stapel

Container-Query-Stapel: CSS-Card. Kopiere die Regeln oder den Prompt, der das Ergebnis nachbaut.

container-queryresponsivemodern-cssadaptivelight

Sized by the parent

Resize the wrapper below 400px and this card stacks vertically.

CSS
.card-069-wrap{container-type:inline-size;max-width:100%}
.card-069{display:flex;flex-direction:column;background:#fff;border:1px solid #e5e7eb;border-radius:14px;overflow:hidden;font-family:system-ui,sans-serif;color:#111827}
.card-069__img{height:160px;background:linear-gradient(135deg,#a7f3d0,#0d9488)}
.card-069__body{padding:18px 20px}
.card-069 h3{margin:0 0 6px;font-size:17px}
.card-069 p{margin:0;font-size:14px;line-height:1.5;color:#6b7280}
@container (min-width:400px){
  .card-069{flex-direction:row}
  .card-069__img{flex:0 0 180px;height:auto}
  .card-069 h3{font-size:20px}
}
HTML
<div class="card-069-wrap" style="width:520px">
  <article class="card-069">
    <div class="card-069__img"></div>
    <div class="card-069__body"><h3>Sized by the parent</h3><p>Resize the wrapper below 400px and this card stacks vertically.</p></div>
  </article>
</div>
Prompt

Baue eine Card, die auf ihren Container reagiert, nicht auf den Viewport. Wickle sie in ein div mit container-type: inline-size. Die Card ist weiß mit 1px #e5e7eb Rahmen und 14px Radius, standardmäßig gestapelt (160px Bild oben mit 135deg Gradient #a7f3d0 zu #0d9488, dann ein Body mit 17px Titel und 14px #6b7280 Text). Unter @container (min-width: 400px) auf eine Zeile mit fester 180px Bildspalte wechseln und den Titel auf 20px anheben.