Skip to content

Instantly share code, notes, and snippets.

@caitfriedlander
Created May 30, 2018 02:27
Show Gist options
  • Save caitfriedlander/838fb2bfc357c5f5c45e9d66fbeda89a to your computer and use it in GitHub Desktop.
Save caitfriedlander/838fb2bfc357c5f5c45e9d66fbeda89a to your computer and use it in GitHub Desktop.
Abstract Art // source http://jsbin.com/kizicax
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Abstract Art</title>
<style id="jsbin-css">
.box-1 {
background-color: red;
height: 100px;
width: 300px;
}
.box-2 {
background-color: green;
height: 400px;
width: 750px;
}
.box-3 {
background-color: blue;
height: 990px;
width: 100px;
}
</style>
</head>
<body>
<script id="jsbin-javascript">
var i;
for (i = 1; i < 4; i++) {
var boxElement = document.createElement('div');
boxElement.textContent = 'box-' + i;
boxElement.className = 'box-' + i;
document.getElementsByTagName('body')[0].appendChild(boxElement);
}
</script>
<script id="jsbin-source-css" type="text/css">
.box-1 {
background-color: red;
height: 100px;
width: 300px;
}
.box-2 {
background-color: green;
height: 400px;
width: 750px;
}
.box-3 {
background-color: blue;
height: 990px;
width: 100px;
}
</script>
<script id="jsbin-source-javascript" type="text/javascript">var i;
for (i = 1; i < 4; i++) {
var boxElement = document.createElement('div');
boxElement.textContent = 'box-' + i;
boxElement.className = 'box-' + i;
document.getElementsByTagName('body')[0].appendChild(boxElement);
}</script></body>
</html>
.box-1 {
background-color: red;
height: 100px;
width: 300px;
}
.box-2 {
background-color: green;
height: 400px;
width: 750px;
}
.box-3 {
background-color: blue;
height: 990px;
width: 100px;
}
var i;
for (i = 1; i < 4; i++) {
var boxElement = document.createElement('div');
boxElement.textContent = 'box-' + i;
boxElement.className = 'box-' + i;
document.getElementsByTagName('body')[0].appendChild(boxElement);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment