Typed attr() (attr(data-x type(<length>)))
Chrome 133; Firefox 152 Nightly (flag), Safari Technology Preview 249. Interop 2026 focus area. Not Baseline.
Chrome 133
Edge 133
Safari TP
Firefox flag
`attr()` now works in any property and can parse the attribute as a type (`type(<length>)`, `type(<color>)`, `px`), so markup data like `data-cols="3"` drives layout without inline styles.
123456
CSS
.fx-062 {
display: grid;
gap: 8px;
grid-template-columns: repeat(attr(data-cols type(<integer>),2),1fr);
font-family: system-ui
}
.fx-062 span {
padding: 12px;
text-align: center;
border-radius: 6px;
background: attr(data-accent type(<color>),#e5e7eb);
color: #fff
}
HTML
<div class="fx-062" data-cols="3" data-accent="#ec4899"><span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span></div>Fallback: The second argument of attr() is the fallback value used by unsupported browsers (they treat the whole attr() as invalid outside `content`, so also set a plain declaration before it).
Prompt
Feed layout values from data attributes with typed `attr()`: `repeat(attr(data-cols type(<integer>), 2), 1fr)`, `attr(data-accent type(<color>), gray)`. Always give the fallback argument and a preceding plain declaration, because only Chromium ships it in stable as of 2026-09.