CSS appearance Property Demo - Online Reset Native Styles
Reset native styling on form elements with appearance: none. See before and after. Essential for custom forms.
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 propertiesReset native styling on form elements with appearance: none. See before and after. Essential for custom forms.
Understand @layer by visually ordering style layers and seeing which rules win. Fix specificity battles. Modern CSS architecture.
Toggle contain: strict, content, paint, layout and see how it affects rendering. Understand isolation for faster pages.
Swap between physical and logical properties (marginโinline vs marginโleft). Live preview with writingโmode. Internationalize your CSS.
Paste your CSS and see rules sorted by specificity. Find overrides and potential collisions. Understand your cascade.
Define a set of colors for light and dark themes. Get the CSS custom properties snippet. Toggle live.
Write slides in Markdown and instantly preview a webโbased presentation. Export as HTML. Pure frontend.
Create a frosted glass card with background blur, border glow, and shadow. Adjust intensity. Copy the CSS.
Implement a dark/light theme toggle that respects prefersโcolorโscheme. Copy the complete JavaScript and CSS.
Paste your stylesheet and get a clean list of all custom properties defined under :root. Copy the whole block. Local analysis.
Access the Paint Timing API and display First Paint, First Contentful Paint, and Largest Contentful Paint times. Quick perf check.
List all resources loaded by the current page and their detailed timing breakdown. Inโbrowser waterfall.
Mix sodium hypochlorite with water to get the correct % concentration for soft washing. Safety note.
Calculate total work hours and pay from time-in/out entries. Supports overtime and breaks. Generate a printable timesheet. All local.
Set an alarm relative to today's sunset (e.g., 30 minutes before). Perfect for evening routines. Uses geolocation (optional).
Enter a date and location (or use GPS) to see exact golden hour and blue hour times for perfect natural light.
Enter total balance and limit to see utilization percentage. See how it affects credit score bands.
Estimate curing time for UV resin based on lamp wattage and layer thickness. Avoid sticky finishes.
See how extra monthly or lumpโsum payments reduce your mortgage term and total interest. Dynamic chart. All local calculation.
Build a renovate.json file to automate dependency updates. Choose schedule, automerge, and package rules. Local.
Estimate how long a battery will last given capacity (mAh/Wh) and load current. Also computes backup time for power banks. Quick and local.
Click to get a random, unique superpower with a description. Perfect for character creation or daydreaming.
Enter your must volume and current Brix, TA, and pH to calculate additions of sugar, acid blend, or tannin. Standard winemaking formulas.
See the current Service Worker registration, its state, and scope. Send 'skipWaiting' and update. PWA debug.
Drag tasks into a 2x2 grid (Urgent vs. Important or Impact vs. Effort). Visual decision aid. Local.
Record start time and track elapsed fast, symptoms, and electrolyte intake. Private, motivational timeline.
Checklist for plein air painting gear based on medium (oil, watercolor, etc.). Don't forget anything.
List your debts and compare the total interest paid using avalanche vs snowball methods. Pick the best strategy.
Generate encrypted passwords for .htaccess basic authentication. Create .htpasswd entries using bcrypt, MD5, or SHA. Server admin utility, local compute.
Get a random, unique superpower with a detailed description and limit. Perfect for character creation or daydreaming.