Articles Tagged
container
The CSS container
property is a shorthand that combines the container-name
and container-type
properties into a single declaration.
.parent {
container: cards-grid / inline-size;
/* Equivalent to: */
container-name: cards-grid;
container-type: inline-size;
}
Constituent properties
The container
property is a …
container-type
The CSS container-type
property is part of the Container Queries feature used to register an element as a container that can apply styles to other elements when it meets certain conditions.
.parent {
container-type: inline-size;
}
@container (width < 500px)
… container-name
The CSS container-name
property is used to register an element as a container that applies styles to other elements based on the container’s size and styles.
.parent {
container-name: cards;
container-type: inline-size;
}
@container cards (width 800px) {
.child {
… A Few Times Container Size Queries Would Have Helped Me Out
CSS Container Queries are still gaining traction and many of us are getting our hands wet with them, even if it’s for little experiments or whatnot. They’ve got great, but not quite full, browser support — enough to justify using …
Digging Deeper Into Container Style Queries
I wrote up some early thoughts on container style queries a little while back. It’s still early days. They’re already defined in the CSS Containment Module Level 3 specification (currently in Editor’s Draft status) but there are still a couple …
Early Days of Container Style Queries
We’re still in suuuuuper early days with container queries. Too early for broad browser support, but Chromium already supports it, Safari started supporting it in version 16, and Firefox is presumably not far behind.
Most early days conversations …
iShadeed’s Container Queries Lab
Ahmad Shadeed got an early jump on container queries and has a growing collection of examples based on everyday patterns.…
A New Container Query Polyfill That Just Works
Conditional Border Radius In CSS
Ahmad Shadeed documents a bonafide CSS trick from the Facebook CSS codebase. The idea is that when an element is the full width of the viewport, it doesn’t have any border-radius
. But otherwise, it has 8px
of border-radius
. …
Container Units Should Be Pretty Handy
Container queries are going to solve this long-standing issue in web design where we want to make design choices based on the size of an element (the container) rather than the size of the entire page. So, if a container …