Free Web Tools | digtoolsdigtoooooools

CSS Container Query Generator | Build @container Rules Visually

๐Ÿ“– About๐Ÿ”ฐ How to Use๐Ÿ“š Glossaryโš™๏ธ Technicalโ“ FAQ๐Ÿ’ก Use Cases
๐Ÿ”’
Browser-Only

No data is sent to any server

โšก
Presets

6 templates to start instantly

๐Ÿ”„
MQโ†’CQ Convert

Auto-convert media queries

โš ๏ธ Your browser does not support CSS Container Queries. Please use Chrome 105+, Safari 16+, or Firefox 110+.
Selector
container-type
container-name
Presets
โ†” Drag right edge to resize
490px
Custom HTML (for preview)
CSS CODE
@media Input
@container Output

The CSS Container Query Generator lets you visually build CSS @container queries using an intuitive GUI.

Unlike traditional media queries that respond to the viewport width, container queries respond to the parent element's width. This enables truly component-level responsive design with maximum reusability.

Configure container-type and container-name, add breakpoints, choose from presets, preview in real-time by resizing, and convert existing media queries โ€” all entirely in your browser. No data is ever sent to a server.

Container Setup

Set the container-type and container-name in "Container Settings". The most common inline-size is selected by default.

Add Breakpoints

Add breakpoints with conditions (min-width, etc.) and CSS styles. You can also use presets for quick configuration.

Preview

Drag the preview container to resize it and see your container query styles in action. Use fullscreen for wider testing.

Copy Code

Copy the generated CSS code from the "Generated Code" section using the ๐Ÿ“‹ button.

container-type
A property that defines an element as a query container. inline-size enables horizontal queries, size enables both axes.
container-name
A property that gives a container a name. Named containers allow you to target specific containers with your queries.
@container
An at-rule used to write container queries. It applies styles to child elements based on the container's dimensions.
container shorthand
The shorthand container: name / type allows you to set both container-name and container-type in one declaration.
Containment
A CSS specification that isolates element rendering and layout calculations. Setting container-type automatically applies containment.
inline-size
A container-type value that enables querying only on the inline (horizontal) axis. Most commonly used value.

CSS container queries use the @container rule combined with the container-type property. This is a fundamentally different approach from traditional media queries.

Media Queries vs Container Queries

Media queries (@media) change styles based on the viewport dimensions. Container queries (@container) change styles based on the parent container's dimensions. The same component can automatically adapt whether placed in a sidebar or main content area.

container-type Values

inline-size enables querying on the horizontal axis only โ€” the most common choice. size enables querying on both horizontal and vertical axes but requires height containment. normal is the default and disables container queries.

Browser Support

Supported in Chrome 105+, Safari 16+, Firefox 110+, Edge 105+. All modern browsers since 2023. Unsupported browsers simply ignore @container rules without breaking the layout (progressive enhancement).

Q. Is any data sent to a server?
A. No. All processing happens entirely in your browser. No data, including the generated CSS, is ever sent to a server.
Q. What is the difference between container queries and media queries?
A. Media queries respond to the viewport width, while container queries respond to the parent element's width. This enables component-level responsive design.
Q. Which browsers support container queries?
A. Chrome 105+, Safari 16+, Firefox 110+, and Edge 105+. All modern browsers have supported them since 2023. Internet Explorer is not supported.
Q. Can I convert existing media queries to container queries?
A. Yes. Use the "Media Query Conversion" feature to automatically convert @media to @container.
Q. What is the difference between inline-size and size?
A. inline-size allows queries on the horizontal axis only. size allows queries on both axes. inline-size is sufficient for most use cases.
Q. Does it work on mobile?
A. Yes. The tool is responsive, though the preview resize works best on desktop.
Q. Is this tool free?
A. Yes. Completely free with no usage limits.
๐Ÿ“ฆ

Component UI

Make card components that automatically adapt layout when placed in a sidebar vs. main content area. One definition, works everywhere.

๐ŸŽจ

Design Systems

Build container-aware components that display correctly regardless of placement. Define once, reuse across your entire design system.

๐Ÿ“

CMS Widgets

Create WordPress widgets that auto-adjust based on widget area width. Perfect for sidebars, footers, and flexible content areas.

๐Ÿ“Š

Dashboards

Optimize graph and stats display based on panel size. Ideal for resizable dashboard panels and data visualization components.

๐Ÿ” Fullscreen Preview
800px
CSS