The <dashed-ident>
CSS data type denotes an arbitrary string used as an identifier.
The <dashed-ident>
CSS data type denotes an arbitrary string used as an identifier.
The syntax of <dashed-ident>
is similar to CSS identifiers (such as property names), except that it is case-sensitive. It starts with two dashes, followed by the user-defined identifier.
The double dash at the beginning makes them easily identifiable when reading through a CSS code block.
Just like <custom-ident>
<dashed-ident>
s are defined by the user, but unlike <custom-ident>
CSS will never define a <dashed-ident>
.
When <dashed-ident>
is used with CSS custom properties, the property is declared first and then used within a CSS var() function.
html { --primary-color: red; --secondary-color: blue; --tertiary-color: green; } h1, h4 { color: var(--primary-color); } h2, h5 { color: var(--secondary-color); } h3, h6 { color: var(--tertiary-color); }
When <dashed-ident>
is used with the @color-profile at-rule, the at-rule is declared first and then used within a CSS color() function.
@color-profile --my-color-profile { src: url("https://example.org/SWOP2006_Coated5v2.icc"); } .header { background-color: color(--my-color-profile 0% 70% 20% 0%); }
When <dashed-ident>
is used with the @font-palette-values at-rule, the at-rule is declared first and then used as the value for the font-palette property.
@font-palette-values --my-palette { font-family: Bixa; base-palette: 1; override-colors: 0 #ff0000; } h1, h2, h3, h4 { font-palette: --my-palette; }
Specification |
---|
CSS Values and Units Module Level 4 # dashed-idents |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/dashed-ident