Skip to content

Instantly share code, notes, and snippets.

@FrankFang
Last active August 27, 2016 17:04
Show Gist options
  • Save FrankFang/a72c45e034bf051d8ebef02715923179 to your computer and use it in GitHub Desktop.
Save FrankFang/a72c45e034bf051d8ebef02715923179 to your computer and use it in GitHub Desktop.
DOM Example
///DOM example
var h = 100
var div = document.createElement('div')
div.style.height = h + 'px'
div.style.width = '100px'
div.style.background = "#3cbd63"
var div2 = document.createElement('div')
div2.style.height = '10px'
div2.style.width = '10px'
div2.style.background = "red"
div.appendChild(div2)
div
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment