How to add styles to an HTML element from a string
Posted on November 6, 2021
Here the little snippet:
const div = document.createElement('div')
const styles = 'width:100%;background-color:red;'
div.setAtribute('style', styles)
Posted on November 6, 2021
Here the little snippet:
const div = document.createElement('div')
const styles = 'width:100%;background-color:red;'
div.setAtribute('style', styles)