CSS Blend Mode Playground โ Online background-blend-mode & mix-blend-mode
Load images or use colors and apply all 15 CSS blend modes. Visual tester for creative effects.
UD5 Toolkit
Explore element.attributeStyleMap โ the typed, programmatic way to manipulate CSS
No properties set via attributeStyleMap yet.
Use Set or click a Preset above.
| Property | Type | Value |
|---|
element.style.width = '200px', you use typed objects such as CSSUnitValue, CSSMathValue, and CSSKeywordValue. The attributeStyleMap is a property on every DOM element that returns a StylePropertyMap โ a Map-like object for getting and setting CSS properties using these typed values. It provides better performance, type safety, and eliminates string parsing.
| Feature | element.style | attributeStyleMap |
|---|---|---|
| Value format | Strings only | Typed objects (CSSUnitValue, etc.) |
| Type safety | None (string parsing) | Full type information preserved |
| Math operations | Requires calc() strings | CSSMathValue objects, programmatic |
| Iteration | Manual parsing | Map-like: for...of, entries(), keys() |
| Performance | String concat + reparse | Direct typed manipulation, faster |
| Browser support | Universal | Chrome 66+, Edge 79+, Opera 53+ |
new CSSUnitValue(200, 'px') or shorthand CSS.px(200). Properties: .value (number) and .unit (string).block, none, auto, or color names like red. Created via new CSSKeywordValue('block').CSSMathSum, CSSMathProduct, CSSMathMin, CSSMathMax, and CSSMathClamp. These enable programmatic calc()-like operations without string building.transform as an array of transform components like CSSTranslate, CSSRotate, CSSScale.if (typeof CSSUnitValue === 'function') or if (element.attributeStyleMap) and gracefully fall back to element.style for unsupported browsers.
--my-color) work seamlessly with attributeStyleMap. You can set them using element.attributeStyleMap.set('--my-color', new CSSKeywordValue('blue')) or with parsed values. This is particularly powerful because it allows type-safe manipulation of custom properties that might be consumed by other parts of your stylesheet via var(). Try the Custom Props preset in this playground to see it in action.
element.style requires converting between strings and internal typed representations repeatedly โ every time you read a value, the browser serializes it to a string; every time you write, it parses the string back. With Typed OM, values stay in their typed representation, eliminating serialization and parsing overhead. For animation-heavy applications or frequent style updates (e.g., during scroll, pointer events, or Web Animations API usage), this can significantly reduce jank and improve frame rates. Google's benchmarks show up to ~30% faster style operations in some scenarios.
attributeStyleMap returns a StylePropertyMap (which behaves like a Map), you can iterate using standard patterns:
// Using for...of
for (const [prop, value] of element.attributeStyleMap) {
console.log(prop, value.toString(), value.constructor.name);
}
// Using entries()
for (const [prop, value] of element.attributeStyleMap.entries()) {
console.log(`${prop}: ${value}`);
}
// Using forEach
element.attributeStyleMap.forEach((value, prop) => {
console.log(prop, value);
});
You can also use .keys(), .values(), .has(prop), and .size.
border, margin, padding, background, and font represent multiple longhand properties simultaneously. The Typed OM generally requires you to use longhand properties (e.g., margin-top, border-left-width) when setting values via attributeStyleMap.set(). Attempting to set a shorthand may throw a TypeError. This is by design โ it ensures type precision. The playground above primarily uses longhand properties for this reason. You can still get computed values of shorthands via element.computedStyleMap().get('margin') in some cases, but the returned value structure varies.
CSS.px(200) โ CSSUnitValue {value: 200, unit: 'px'}CSS.em(1.5) โ CSSUnitValue {value: 1.5, unit: 'em'}CSS.percent(80) โ CSSUnitValue {value: 80, unit: '%'}CSS.deg(45) โ CSSUnitValue {value: 45, unit: 'deg'}CSS.vw(50), CSS.vh(100), CSS.s(2)new CSSMathSum(CSS.px(100), CSS.px(50))new CSSMathProduct(CSS.px(10), 3)new CSSMathMin(CSS.px(100), CSS.px(200))new CSSMathMax(CSS.vw(50), CSS.px(300))new CSSMathClamp(CSS.px(50), CSS.px(100), CSS.px(200)).set(prop, CSSStyleValue) โ Set a typed value.get(prop) โ Returns CSSStyleValue or null.has(prop) โ Returns boolean.delete(prop) โ Remove a property.clear() โ Remove all inline styles.size โ Number of propertiesLoad images or use colors and apply all 15 CSS blend modes. Visual tester for creative effects.
Apply userโselect: none, text, all and see how it affects selection. Copy the CSS snippet for your UI elements.
Test the new style() function inside @container to query custom property values. Revolutionary componentโbased responsive design.
Register a custom CSS property with syntax, initial value, and inherits. Animate colors and numbers that couldnโt before.
Paste your CSS and see rules sorted by specificity. Find overrides and potential collisions. Understand your cascade.
Write CSS with native nesting (like SCSS) and see the browserโs native parsing. Validator and live output.
Swap between physical and logical properties (marginโinline vs marginโleft). Live preview with writingโmode. Internationalize your CSS.
Reset native styling on form elements with appearance: none. See before and after. Essential for custom forms.
Paste your CSS and get a sorted list of all custom properties defined under :root with their values. Quick audit.
See every HTML input type in one page. Check browser support and styling. Copy sample markup. Quick frontend reference.
Set up multiple @layers and use revertโlayer to fall back. See the computed style and cascade resolution live.
Paste your stylesheet and get a clean list of all custom properties defined under :root. Copy the whole block. Local analysis.
Apply willโchange to any element and see its effect on compositing. Learn best practices for smooth animations.
Implement a dark/light theme toggle that respects prefersโcolorโscheme. Copy the complete JavaScript and CSS.
Access the Paint Timing API and display First Paint, First Contentful Paint, and Largest Contentful Paint times. Quick perf check.
Upload any picture and instantly get a 5โcolor palette. Useful for UI design themes. Canvasโbased extraction.
Build a Vite configuration file by selecting plugins (Vue, React, etc.), aliases, and build options. Copy the final code.
List all resources loaded by the current page and their detailed timing breakdown. Inโbrowser waterfall.
Build a renovate.json file to automate dependency updates. Choose schedule, automerge, and package rules. Local.
Paste a raw server log snippet and see a structured table with IP, method, URL, and status. Quick audit.
Generate a random 5โcolor palette where every adjacent pair passes WCAG AA contrast. Safe for inclusive designs.
Enter network name and password to generate a stylish printable card for visitors. Local, no data leak.
A completely black page to save battery on OLED devices. Click to go fullscreen. Simple utility.
Set an alarm relative to today's sunset (e.g., 30 minutes before). Perfect for evening routines. Uses geolocation (optional).
Log shedding events, note duration, and track humidity to optimize next cycle. Healthy scales.
See the current Service Worker registration, its state, and scope. Send 'skipWaiting' and update. PWA debug.
Estimate arrival time with driving duration, breaks, and time zone changes. Plan your road trip precisely.
Choose where page breaks should occur for printing. Get the breakโbefore, breakโafter, and breakโinside CSS.
See the current state of a Service Worker for your page: installing, waiting, active. Unregister or skip waiting. Developer utility.
Get a random, unique superpower with a detailed description and limit. Perfect for character creation or daydreaming.