Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <html>
<head>
    <title>Pixel Art Maker!</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	  <link href="https://fonts.googleapis.com/css?family=Orbitron" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.5.2/animate.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
    <div id="particles-js"></div>
  
    <div id="mainContainer">
      <h1 id="heading1" class="animated slideInDown">Lab: Pixel Art Maker</h1>
      <p id="designerText">Designed with <span id ="heart">&hearts;</span> by <span id ="designer">Pradeep Singh</span>
        <span id="social">
          <a href="https://www.facebook.com/psrajputofficial/" target="_blank" class="fa fa-facebook"></a>
          <a href="https://twitter.com/mepsrajput" target="_blank" class="fa fa-twitter"></a>
          <a href="https://plus.google.com/+PradeepSinghRajputOfficial/" target="_blank" class="fa fa-google"></a>
          <a href="https://www.linkedin.com/in/mepsrajput/" target="_blank" class="fa fa-linkedin"></a>
          <a href="https://www.instagram.com/psrofficial/" target="_blank" class="fa fa-instagram"></a>
          <a href="https://join.skype.com/invite/ILGR1q9D0Hzv" target="_blank" class="fa fa-skype"></a> 
        </span>
      </p>
      
        <div class="grid-container">
          <div class="grid-item animated slideInLeft">
            <p id="tooltip">1. Choose Grid Size
                <span id="tooltiptext">Enter Width & Height</span>
            </p>
            <form id="sizePicker">
                <input type="number" id="inputWidth"  min="1" max="50" placeholder="width" required>
                <input type="number" id="inputHeight" min="1" max="50" placeholder="height" required>
                <input type="submit">
            </form>
          </div>
          <div class="grid-item animated slideInUp">
            <p id="tooltip2">2. Pick A Color
              <span id="tooltiptext2">Choose the Grid Color</span>
            </p>
            <input type="color" id="colorPicker">
          </div>
          <div class="grid-item animated slideInRight">
            <p id="tooltip3">3. Design Canvas
               <span id="tooltiptext3">Reset Color or Table</span>
            </p>
            <div>
              <input type="button" id="resetColor" value="Reset Color" onclick="resetColor()">
              <input type="button" id="resetTable" value="Reset Table" onclick="resetCanvas()">
            </div>
          </div>  
        </div>

       <div id="drawArea">
          <table id="pixelCanvas"></table>
        </div> 
      </div>
</body>
</html>
              
            
!

CSS

              
                body, html {
	margin: 0; padding: 0;
}

body{
	text-align: center;
	min-height: 200vh;
  width: 100vw !important;
	background: #ccccff;
  overflow-x: hidden;
}

/* ---- particles.js container ---- */
canvas{ 
  display: block; 
  vertical-align: bottom; 
  min-height: 200vh;
}

#particles-js {
  position: absolute;
  width: 100%;
  min-height: 200vh;
  background-image: url("");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: 50% 50%;
}

#mainContainer {
  max-width: 100vw;
  margin: 0 auto;
  padding: 0;
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  min-height: 100%;
}

h1 {
	font-family: 'Prosto One', cursive;
	color: #111;
  font-size: 50px;
	margin: .5em;
	padding: .15em;
	text-shadow: 1px 2px 3px gray;
	box-shadow: 2px 3px 8px #b7b7e5;
}

#heading1 {
	animation-delay: 0s;
	animation-duration: 2s;
	animation-iteration-count: 1;
}
.grid-container {
  display: grid;
  grid-template-columns: auto auto auto;
  grid-column-gap: 0px;
  background-color: #eee;
  width: 80%;
  margin: 0px auto;
}

.grid-item {
  background-color: #e5e5ff;
  border: 1px solid rgba(220, 220, 220, 0.8);
  text-align: center;
  margin: 0;
}

#drawArea {
  min-width: 100%;
  margin: 20px auto;
 	min-height: 100vh;
}

#designerText{
  margin-top: -15px;
  font-size: 0.8rem;
}

#heart {
  color: red; 
  font-size: 14px;
  font-weight: bold;
}

#designer {
    font-weight: bold;
}

.fa {
  padding: 5px;
  font-size: 5px;
  width: 13px;
  text-align: center;
  text-decoration: none;
  margin: 0px 2px;
  border-radius: 50%;
}

.fa:hover {
    opacity: 0.8;
}

.fa-facebook {
  background: #3B5998;
  color: white;
}

.fa-twitter {
  background: #55ACEE;
  color: white;
}

.fa-google {
  background: #dd4b39;
  color: white;
}

.fa-linkedin {
  background: #007bb5;
  color: white;
}

.fa-instagram {
  background: -webkit-linear-gradient(#4c68d7,#8a3ab9,#fbad50); /* Safari 5.1-6.0 */
  background: -o-linear-gradient(#4c68d7,#8a3ab9,#fbad50); /* Opera 11.1-12.0 */
  background: -moz-linear-gradient(#4c68d7,#8a3ab9,#fbad50); /* Firefox 3.6-15 */
  background: linear-gradient(#4c68d7,#8a3ab9,#fbad50); /* Standard syntax */  color: white;
}

.fa-skype {
  background: #00aff0;
  color: white;
}


.grid-item {
	animation-delay: 0s;
	animation-duration: 3s ;
	animation-iteration-count: 1;
}

p {
	text-shadow: 1px 1px 1px gray;
}

#tooltip {
    position: relative;
    display: inline-block;
}

#tooltip #tooltiptext {
    visibility: hidden;
    width: 140px;
    background-color: green;
    color: #eee;
    font-size: .8em;
    text-align: center;
    border-radius: 6px;
    padding: 5px 0;
    position: absolute;
    z-index: 1;
    top: -5px;
    right: 110%;
}

#tooltip #tooltiptext::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 100%;
    margin-top: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: transparent transparent transparent green;
}
#tooltip:hover #tooltiptext {
    visibility: visible;
}
#tooltip #tooltiptext {
    opacity: 0;
    transition: opacity 1s;
}

#tooltip:hover #tooltiptext {
    opacity: 1;
}

#tooltip2 {
    position: relative;
    margin-top: 0;
    margin-bottom: 10px;
}

#tooltip2 #tooltiptext2 {
    font-size: 0.8em;
    visibility: hidden;
    width: 140px;
    background-color: green;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px 0;
    position: absolute;
    z-index: 1;
    bottom: 150%;
    left: 50%;
    margin-left: -60px;
}

#tooltip2 #tooltiptext2::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: green transparent transparent transparent;
}

#tooltip2:hover #tooltiptext2 {
    visibility: visible;
}

#tooltip2 #tooltiptext2 {
    opacity: 0;
    transition: opacity 1s;
}

#tooltip2:hover #tooltiptext2 {
    opacity: 1;
}

#tooltip3 {
    position: relative;
    margin-bottom: 10px;
    display: inline-block;
}

#tooltip3 #tooltiptext3 {
    font-size: 0.8em;
    visibility: hidden;
    width: 140px;
    background-color: green;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px 0;
    position: absolute;
    z-index: 1;
    top: -5px;
    left: 110%;
}

#tooltip3 #tooltiptext3::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 100%;
    margin-top: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: transparent green transparent transparent;
}

#tooltip3:hover #tooltiptext3 {
    visibility: visible;
}

#tooltip3 #tooltiptext3 {
    opacity: 0;
    transition: opacity 1s;
}

#tooltip3:hover #tooltiptext3 {
    opacity: 1;
}

#resetColor, #resetTable {
  display: inline;
  margin: 2px auto;
}

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

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

tr {
    height: 20px;
}

td {
    width: 20px;
}

input[type=number] {
    width: 4em;
	padding: .35em;
	outline: 0;
}

input[type=submit], input[type=button] {
	min-width: 5em;
	padding: .35em;
	font-weight: bold;
	background-color: #fff;
	border: 1px solid #bbb;
	border-radius: 3px;
	box-shadow: 3px 5px 16px #bdbdbd;
}

input[type=submit]:hover, input[type=button]:hover {
	box-shadow: 1px 2px 8px #bdbdbd;
	transition: ease-in-out;
    transition-duration: .2s;
    transition-delay: initial;
}

input[type=submit]:focus, input[type=button]:focus{
	outline: 0;
}

@media screen and (max-width: 762px) {
  input[type=submit], input[type=number] {
    display: block;
    margin: 2px auto;
  }
  
  #tooltip {
    margin-top: 5px;
    margin-bottom: 0;
  }
  #tooltip, #tooltip3 {
    margin-top: 10px;
    padding-top: 10px;
  }
  
  #tooltip2 {
    margin-top: -15px auto !important;
    padding-top: -10px;
  }
  
  #tooltip1 #tooltiptext1:hover, #tooltip2 #tooltiptext2:hover, #tooltip3 #tooltiptext3:hover {
    display: none;
  }
  
  #social{
    display: block;
    width: 90vw;
    margin: 5px auto;
  }
} 

              
            
!

JS

              
                $(document).ready(function(){
	
	$('#sizePicker').submit(function makeGrid(grid) {
		/* ------- Clear previous grid (if present) ------- */
		$('#pixelCanvas').empty();
		
		/* ------- Select size input ------- */
		let row_input = $('#inputHeight').val();
		let col_input = $('#inputWidth').val();
		for (i = 1; i <= row_input; i++) {
		    $('table').append("<tr></tr>");
		    for (j = 1; j <= col_input; j++) {
				$('tr:last').append("<td></td>");
				$('td').attr("class", 'cells');
		    }
		}
		
		/* ------- Select color input ------- */
		$('.cells').click(function (event) {
			const paint = $('#colorPicker').val();
      if($(this).attr('style')){
        $(this).removeAttr('style');
      } else{
        $(this).attr('style','background-color:'+paint);
      }
			// $(event.target).css('background-color', paint);
		});
    
   
		e.preventDefault();
		return false;
	});
});

function resetCanvas() {
	$('#pixelCanvas').empty(); 
}

function resetColor() {
    $('td').css({"background-color": ""});
  }

particlesJS("particles-js", {
  "particles": {
    "number": {
      "value": 180,
      "density": {
        "enable": true,
        "value_area": 800
      }
    },
    "color": {
      "value": "#4c4cff"
    },
    "shape": {
      "type": "circle",
      "stroke": {
        "width": 0,
        "color": "#000000"
      },
      "polygon": {
        "nb_sides": 5
      },
      "image": {
        "src": "img/github.svg",
        "width": 100,
        "height": 100
      }
    },
    "opacity": {
      "value": 0.1,
      "random": false,
      "anim": {
        "enable": false,
        "speed": 1,
        "opacity_min": 0.1,
        "sync": false
      }
    },
    "size": {
      "value": 4,
      "random": true,
      "anim": {
        "enable": false,
        "speed": 40,
        "size_min": 0.1,
        "sync": false
      }
    },
    "line_linked": {
      "enable": false,
      "distance": 150,
      "color": "#ffffff",
      "opacity": 0.4,
      "width": 1
    },
    "move": {
      "enable": true,
      "speed": 2,
      "direction": "none",
      "random": false,
      "straight": false,
      "out_mode": "out",
      "bounce": false,
      "attract": {
        "enable": false,
        "rotateX": 600,
        "rotateY": 1200
      }
    }
  },
  "interactivity": {
    "detect_on": "canvas",
    "events": {
      "onhover": {
        "enable": false,
        "mode": "grab"
      },
      "onclick": {
        "enable": true,
        "mode": "push"
      },
      "resize": true
    },
    "modes": {
      "grab": {
        "distance": 140,
        "line_linked": {
          "opacity": 1
        }
      },
      "bubble": {
        "distance": 400,
        "size": 40,
        "duration": 2,
        "opacity": 8,
        "speed": 3
      },
      "repulse": {
        "distance": 200,
        "duration": 0.4
      },
      "push": {
        "particles_nb": 4
      },
      "remove": {
        "particles_nb": 2
      }
    }
  },
  "retina_detect": true
});

              
            
!
999px

Console