Created
May 7, 2018 19:53
-
-
Save jrrio/96d64c301c48fb9d5c04df16c9035c77 to your computer and use it in GitHub Desktop.
Assigning styles to an HTML element
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var el = document.getElementById("elemID"); | |
el.style.cssText = "color:#fff;width:320px;height:240px;"; | |
// Or: | |
Object.assign(el.style, | |
{ | |
"color": "#fff", | |
"width": "320px", | |
"height": "240px" | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment