48 CZ-PRG (GMT+1)
US-NYC (GMT-5)
Blazor Web App (Server rendered)

WEB DESIGN TRENDS / 18 OF 20

Container Queries

Container queries let a component respond to the width of its own parent instead of the viewport. The source example resizes a product card and changes its layout at 300, 440, and 640 pixels.

Use them for reusable cards and widgets that appear in different page regions. Viewport media queries still work well for overall page composition. Bootstrap 5.3

DESCRIPTION & USE

How the trend works

Container queries let a component respond to the width of its own parent instead of the viewport. The source example resizes a product card and changes its layout at 300, 440, and 640 pixels.

Where to use it

Use them for reusable cards and widgets that appear in different page regions. Viewport media queries still work well for overall page composition.

What Bootstrap 5.3 can do

Bootstrap provides containers, columns, and cards for the outer layout. Container-type and CSS container rules are native features rather than Bootstrap classes.

Useful classes .container, .row, .col-*, .card, .d-flex, .gap-*, .form-range

FROM THE ATTACHED HTML

The original example

RESPONSIVE COMPONENT

Orbit 3D

The card switches from stacked to side-by-side as its container grows.

A PRACTICAL EXTENSION

One more way to use it

Added example
Test the component in a narrow sidebar and a wide main column. A viewport breakpoint cannot tell whether a card's own container has enough room.
An unhandled error has occurred. Reload 🗙

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.