LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code

    

Lab: Pixel Art Maker

Choose Grid Size

Grid Height: Grid Width:

Pick A Color

Design Canvas

CSS
body {
    text-align: center;
}

h1 {
    font-family: Monoton;
    font-size: 70px;
    margin: 0.2em;
}

h2 {
    margin: 1em 0 0.25em;
}

h2:first-of-type {
    margin-top: 0.5em;
}

table,
tr,
td {
    border: 1px solid black;
}

table {
    border-collapse: collapse;
    margin: 0 auto;
}

tr {
    height: 20px;
  
}

td {
    width: 20px;
}

input[type=number] {
    width: 6em;
}
JS
function makeGrid(){
  
//Table Row & Col assignment
		var cvRow = $("#input_height").val();
		var cvCol = $("#input_width").val();
  //Table assignment
  		var canvas = $("#pixel_canvas");
		canvas.children().remove();
  //Generate Table Row
		for(var r = 0 ; r < cvRow; r++){
			canvas.append("");
      //Generate Table Col
			for(var c = 0 ; c < cvCol; c++){
				canvas.children().last().append("");		
			}
		}
  
	}
 	
// Your code goes here!
$("input[type='submit']").click(function(eve) {
	eve.preventDefault();
  makeGrid();
});
Wed, 12/27/2017 - 07:03

Related Codes

Pen ID
Pen ID
Pen ID
Square Adv