⭐️
Container Queries — a new way to make layouts responsive.
Before:
@media rules reacted to screen width (e.g. under 768px → smaller font).
Problem: components behave differently in cards, sidebars, modals — viewport alone isn’t enough.
Container Queries let CSS adapt to a parent’s size, not the whole screen.
➡️
Example:.card { container-type: inline-size; }
@container (max-width: 400px) {
.card-title { font-size: 1rem; }
}How it works• Mark a container with container-type.
• Use
@container to style elements inside it.
• Components adapt to parent width, no global media hacks.
• Cleaner CSS, fewer JS tweaks, local responsive behavior.
📌 Supported natively in modern browsers — truly component-based CSS.
💎
@Htmlcss_channels | #css #JavaScript #HTML