/* Single value */
type(<color>)
type(auto)
/* "|" combinator for multiple types */
type(<length> | <percentage>)
/* Space-separated list of values */
type(<color>+)
/* Comma-separated list of values */
type(<length>#)
/* Multiple keywords */
type(red | blue | green)
/* Combination of data type and keyword */
type(<percentage> | auto)
/* Universal syntax value */
type(*)`type()` CSS function / notebook
`type()` CSS function
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
background-color: attr(data-background type(<color>), red);@function --color-choice(--color1 type(red | green), --color2 blue) {
result: var(--color1);
@media (width < 700px) {
result: var(--color2);
}
}