Skip to content
Run here 100% in your browser, no upload, no login

Container Query Builder

Compose @container queries with a container name, size conditions and and/or/not.

Container

First condition

Generated CSS

How to use it

  1. Type a container name, or leave it empty to produce an anonymous query.
  2. Choose the container-type. inline-size lets you query the width, size adds height queries but requires a definite height.
  3. Set the first condition, for example min-width 400px, and tick the box if you need a second one.
  4. Pick the relation. and requires both, or accepts either, not negates the first condition only.
  5. Copy the CSS. The first block declares the container on the wrapper, the second holds your component rules.

Common use cases

Why it stays private

The rule is assembled from the values you type. There is no upload, no account and no network request, so your class names and sizes stay in your browser.

FAQ

Q: Why does nothing happen when I add a container-type? A: A container query only matches inside a descendant of the declared container. Make sure the element you style sits inside the wrapper that carries container-type, not inside a different branch of the tree.

Q: When should I use size instead of inline-size? A: Use inline-size for width based queries, which is the common case. Use size only when the container has a height that does not depend on its content, otherwise height queries may resolve against an auto height and not behave as you expect.

Q: Can a container query look at the viewport? A: No. A container query measures the nearest ancestor container with a matching container-type. If you want to react to the viewport, use a media query instead.

Your data stays on this device

Container Query Builder runs 100% locally. Everything you paste or drop is processed by your own browser and never transmitted. Nothing is stored on our servers — close the tab and it is gone.

Nothing you type is sent to a server, logged, or used for analytics. The page works even with your network disconnected after first load.