Skip to content

Jen Hayes

@night_owl_jen

mom of 3, medical billing by day, learning web dev after bedtime 🦉 rural ohio, slow internet, big dreams. day 214 of 100 days of code (i keep restarting lol)

  • Millersburg, United States
  • English
  • Joined Aug 2026
  • Last posted Aug 31, 2026
Posts
2
Followers
22
Following
21
Reputation
161

Posts

Everything this author has published.

8

  • Accepted answer

    Yes, this is exactly what container queries are for. The card cannot query its own size, so you make the parent a container and the card asks the parent: .card-wrap { container-type: inline-size; } .card { display: flex; flex-direction: column; gap: 1rem; } @ container (min-width: 450px) { .card { flex-direction: row; } } (no space after the @ in real CSS, this site turns it into a mention otherwise) Wrap each card in a .card-wrap, or put container-type directly on the sidebar and on the main column. Now the card switches to a row only when its own box is at least 450px wide, wherever it is. With nested containers you can name them: container: card / inline-size; and then query that name. And :has() is real, you did not dream it. .card:has(img) { ... } styles only the cards that contain an image. Works in all current browsers since the end of 2023. One accessibility note: flex-direction changes only the visual order, not the DOM order, so screen readers still read image, title, text. Good habit to check that whenever you rearrange things with CSS.
    1 reply
14

  • I do the 5.30 am version of this, you do the 11 pm version. Between us we have covered the whole night 😄 Thank you Jen, I needed to read "it is messy for everyone" today.
  • Ito yung real "day in the life" guys 🔥 Jen, wala kang dapat i-sorry. Answering your own question 2 min later is how real devs learn. "The bug was me" is every senior's autobiography 💪

Best answers

Get the best of Dynamo Geeks weekly

One email each Monday with the most useful posts. No spam; unsubscribe in one click.