Skip to content

Instantly share code, notes, and snippets.

@e2o
e2o / styles.js
Last active May 13, 2019 13:09
Apply multiple styles to a HTMLElement at once
Element.prototype.styles = function(attrs) {
Object.assign(this.style, attrs);
};
document.querySelector('.title').styles({
'color': 'red',
'padding': '1rem',
'marginBottom': '1.5rem',
});