Limited Availability
CSS
id: attr
attr()
The
attr() CSS function, in the context of any property, returns the value of an attribute of an HTML element, with the option to return it as a specific type or unit. You can set a default value for missing or invalid attributes.
Baseline Status:
This feature is currently Limited and is missing in at least one major browser engine.
Desktop Browser Engine Support
Google Chrome
133
Supported
Mozilla Firefox
155
Supported
Apple Safari
—
Unsupported
Microsoft Edge
133
Supported
Mobile Browser Engine Support
Chrome Android
133
Firefox Android
155
Safari iOS
—
Specifications and References
MDN Browser Compat Data Keys:
css.types.attr.declaration-value ↗
css.types.attr.fallback ↗
css.types.attr.type_function ↗
css.types.attr.type_function.angle ↗
css.types.attr.type_function.color ↗
css.types.attr.type_function.custom-ident ↗
css.types.attr.type_function.ident ↗
css.types.attr.type_function.image ↗
css.types.attr.type_function.integer ↗
css.types.attr.type_function.length ↗
css.types.attr.type_function.length-percentage ↗
css.types.attr.type_function.number ↗
css.types.attr.type_function.percentage ↗
css.types.attr.type_function.resolution ↗
css.types.attr.type_function.string ↗
css.types.attr.type_function.time ↗
css.types.attr.type_function.transform-function ↗
css.types.attr.type_function.url ↗