How to reset the style properties to their CSS defaults in javascript?

The new way:

el.attributeStyleMap.delete('color')

or clear everything:

el.attributeStyleMap.clear()

Not all browsers support this yet though. See StylePropertyMap on MDN for more details and browser compatibility.

See also CSS Typed Object Model and Working with the new CSS Typed Object Model.


If recollection serves, obj.style.color="" should work... I don't know if it's right though.


Set the style property values to the empty string:

 obj.style.color = "";