Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ add another resource


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


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.


Auto Save

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.


                <div id="stage">



                BODY {
  background: #000000;

#stage {
position: relative;
margin: 0px auto;
background: #87e0fd;
background: -moz-linear-gradient(top,  #87e0fd 0%, #53cbf1 40%, #05abe0 100%);
background: -webkit-linear-gradient(top,  #87e0fd 0%,#53cbf1 40%,#05abe0 100%);
background: linear-gradient(to bottom,  #87e0fd 0%,#53cbf1 40%,#05abe0 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#87e0fd', endColorstr='#05abe0',GradientType=0 );
  width: 900px;
  height: 400px;
  border-radius: 10px;

.tile {
  position: absolute;
  width: 50px;
  height: 50px;
  border-radius: 10px;

.coin {
  position: absolute;
  width: 30px;
  height: 30px;
  margin: 10px;
  border-radius: 50%;


                //Level Generator -
var rows = 8;
var cols = 18;
var grid = [

function displayLevel() {
  var stage = document.getElementById("stage");
  for (var row = 0; row < rows; row++) {
    for (var col = 0; col < cols; col++) {
      if (grid[row][col]==2) {
          var coin = document.createElement('div');
          coin.className = "coin";
 = row*50 + 'px';
 = col*50 + 'px';
      } else if (grid[row][col]==1) {
          var tile = document.createElement('div');
          tile.className = "tile";
 = row*50 + 'px';
 = col*50 + 'px';
          //Merge tiles which are next to each other
          if (col<cols-1) { if (grid[row][col+1]==1) {'0px';'0px';}}
          if (col>0) { if (grid[row][col-1]==1) {'0px';'0px';}}
          if (row<rows-1) { if (grid[row+1][col]==1) {'0px';'0px';}}
          if (row>0) { if (grid[row-1][col]==1) {'0px';'0px';}}
           //Add tile to the stage