css-container-queries

Style components based on container size using CSS container queries.

Updated Apr 17, 2026
One-click install
npx skills add https://github.com/Chris-Maskey/opencode-config --skill css-container-queries-chris-maskey
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: css-container-queries
Source: https://github.com/Chris-Maskey/opencode-config/tree/main/skills/css-container-queries
Command: npx skills add https://github.com/Chris-Maskey/opencode-config --skill css-container-queries-chris-maskey

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Container queries enable styling components based on their container size rather than the viewport, improving reusability and portability of UI.

Core Features & Use Cases

  • Container-based styling drives CSS rules from the parent container size.
  • Tailwind integration supports container queries via @container and named containers.
  • Use cases include cards, widgets, and dashboards that adapt to their context without page-level layout changes.

Quick Start

Define a container with container-type and optional container-name, then apply @container queries to style child elements based on the container size.

Frequently Asked Questions about css-container-queries

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I make a CSS component responsive based on its parent container size instead of the viewport?

CSS container queries enable component styling based on parent container size rather than the viewport, improving UI reusability across varying parent dimensions like cards and dashboards. You define a container-type and apply @container rules to style child elements contextually.

Does Tailwind CSS support container queries for reusable UI components?

Yes, Tailwind CSS supports container queries through @container and named containers. This integration allows you to build reusable UI components that adapt their styling based on their parent container size rather than the page viewport.

How do I set up container-type and container-name for CSS container queries?

To set up CSS container queries, define a parent element with the container-type property and an optional container-name, then apply @container query rules to style child elements based on that specific container's dimensions.

When should I use container queries instead of media queries for responsive design?

Use container queries instead of media queries when you need reusable UI components, such as cards or widgets, to adapt their layout based on their immediate parent container size rather than the overall page viewport.

Can I apply container queries to dashboard widgets in varying parent layouts?

Yes, container queries are ideal for dashboard widgets in varying parent layouts. They enable component styling driven by the parent container size, allowing widgets to adapt seamlessly without requiring page-level layout changes.