Skip to content

Instantly share code, notes, and snippets.

@tak-dcxi
Created May 16, 2025 17:41
Show Gist options
  • Select an option

  • Save tak-dcxi/315c925c8b154ae97acd74eecb8fcad5 to your computer and use it in GitHub Desktop.

Select an option

Save tak-dcxi/315c925c8b154ae97acd74eecb8fcad5 to your computer and use it in GitHub Desktop.
Container Query Snippets
{
"container": {
"prefix": "container",
"body": [
"--_container-size-min: $1;",
"--_container-size-max: $2;",
"--_to-cqi-min: calc(tan(atan2(1px, var(--_container-size-min))) * 100cqi);",
"--_to-cqi-max: calc(tan(atan2(1px, var(--_container-size-max))) * 100cqi);",
"container: $3 / inline-size;",
"@container style(--debug: true) {",
"\toverflow-x: auto;",
"\tresize: inline;",
"}"
]
},
"cqi-min": {
"prefix": "cqi-min",
"body": ["calc($1 * var(--_to-cqi-min))"]
},
"cqi-max": {
"prefix": "cqi-max",
"body": ["calc($1 * var(--_to-cqi-max))"]
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment