Pen Settings

HTML

CSS

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

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

              
                <p>This demo is working only for Firefox at the moment.<br>See browser support at <a href="http://caniuse.com/#feat=menu">Can I Use</a></p>

<div contextmenu="menu" id="box">
  Right click to get the context menu demo.
</div>
 
<menu type="context" id="menu">

  <menuitem type="checkbox" id="move">I like to move it, move it</menuitem>

  <menuitem type="command" label="Test me" id="custom">Hello World!</menuitem> 
 
  <menuitem type="radio" name="aligngroup" value="left">Align Left</menuitem>

  <menuitem type="radio" name="aligngroup" value="right">Align Right</menuitem>

  <menuitem type="radio" name="aligngroup"  checked="true" value="center">Align Center</menuitem>
   
  <menuitem type="checkbox" disabled>Disabled menu item</menuitem>
</menu>
              
            
!

CSS

              
                .move {
  animation: turn infinite 3s linear;
}
@keyframes turn {
  100% {
    transform: rotate(1turn);
  }
}

#box.alignleft {
  margin-left: 0;
}
#box.alignright {
  margin-right: 0;
}

/* Just decorative things */
body {
  text-align: center;
  font-family: sans-serif;
  line-height: 1.7;
  letter-spacing: 0.01em;
}
#box {
  width: 200px;
  max-width: 100%;
  padding: 20px;
  margin: 2em auto;
  background: #2FB6B6;
  color: #FFF;
  font-weight: bold;
}

#menu:before {
  content: "If you see that menu it's because your browser is not compatible with contextmenu";
  display: block;
  width: 600px;
  padding: 20px;
  max-width: 100%;
  margin: auto;
  background: #F2F2F2;
  font-weight: bold;
  font-size: 0.875em;
}
menuitem {
  display: inline-block;
  margin: 1em .1em;
  padding: .5em;
  background: #AE94C0;
  color: #F2F2F2;
  font-weight: bold;
  font-size: 0.875em;
}
menuitem:hover {
  background: #333;
  cursor: pointer;
}
menuitem[disabled] {
  background: #F2F2F2;
  color: #666;
  cursor: not-allowed;
}
              
            
!

JS

              
                var move    = document.getElementById('move'),
    box     = document.getElementById('box'),
    custom  = document.getElementById('custom'),
    radios  = document.querySelectorAll('[name="aligngroup"]'); 

// moooove action
move.addEventListener('click', function() {
  if ( ! box.classList.contains('move') ) {
    box.classList.add('move');
  } else {
    box.classList.remove('move');
  }
} );

// custom
custom.addEventListener('click', function() {
  alert('This text menu should be "' + this.childNodes[0].nodeValue + '" but label attribute rules the displayed text.' );
} );

// radios
for ( var key in radios ) {
  if ( typeof radios[key] === 'object' ){
    radios[key].addEventListener('click', function() {
      box.classList.remove('aligncenter', 'alignleft', 'alignright');
      box.classList.add('align' + this.getAttribute('value') );
    } )
  }
}


              
            
!
999px

Console