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 class="stage">
    <div class="bin">
      <div class="holder"></div>
      <div class="refresh"><a href="">Refresh</a></div>  


                :root {
  --fontFamily: sans-serif;
  --backgroundColor: #000;
  --textColor: #fff;
  --colorPrimary: #2DDD9F;
  --colorSecondary: #F8632D;
  --timingFast: 0.1s;
  --timingSlow: 0.5s;
  --borderWidth: 1rem;
* {
  box-sizing: border-box;
body {
  background: linear-gradient(to right bottom, var(--colorPrimary), var(--colorSecondary));
  font-family: var(--fontFamily);
  font-size: 62.5%;
.stage {
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(100vh - (var(--borderWidth) * 2));
  width: calc(100vw - (var(--borderWidth) * 2));
  margin: var(--borderWidth);
  padding: 5rem;
  background: var(--backgroundColor);
  overflow: hidden;
a {
  text-decoration: none;
  color: var(--textColor);
  text-shadow: 0 1px 0 rgba(0,0,0,0.4);
  box-shadow: inset 0 -0.05em 0 var(--colorPrimary);
  transition: box-shadow var(--timingSlow) cubic-bezier(0.34, 1, 0.64, 1);    
a:hover {
  box-shadow: inset 0 -0.45em 0 var(--colorSecondary);
  transition: box-shadow var(--timingFast) cubic-bezier(0.34, 1.56, 0.64, 1);    
.bin {
  text-align: center;
.holder {
  font-weight: bold;
  font-size: 12vmin;
  margin-bottom: 1rem;
.holder a {
  color: #fff;
.refresh {
  display: block;
.refresh a {
  text-transform: uppercase;
  opacity: 0.3;
  border-bottom: solid 1px var(--textColor);
    border-bottom var(--timingSlow) cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity var(--timingSlow) cubic-bezier(0.34, 1, 0.64, 1);
  box-shadow: none;
.refresh a:hover {
  opacity: 1;
    border-bottom var(--timingSlow) cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity var(--timingSlow) cubic-bezier(0.34, 1.56, 0.64, 1);
/* Increase that border size at larger sizes */
@media only screen and (min-device-width: 320px) {
  .stage {
    height: calc(100vh - (var(--borderWidth) * 4));
    width: calc(100vw - (var(--borderWidth) * 4));
    margin: calc(var(--borderWidth) * 2);



                var loadRandom = function () {

  //Create a new object to interact with the server
  var xhr = new XMLHttpRequest();

  var url = "*&format=json&generator=random&grnnamespace=0&gnrrlimit=1";

  // Provide 3 arguments (GET/POST, The URL, Async True/False)'GET', url, true);

  // Once request has loaded...
  xhr.onload = function() {

    // Parse the request into JSON
      var data = JSON.parse(this.response);  

      // Loop through the data object
      for (var i in data.query.pages) {

        // Parse data into something useful
        var title = data.query.pages[i].title;
        var url = '' + encodeURIComponent(title).replace(/%20/g, "_");

        // Select container
        var container = document.querySelector('.holder');

        // Create anchor element. 
        var a = document.createElement('a');  

        // Create the text node for anchor element. 
        var link = document.createTextNode(title); 

        // Append the text node to anchor element. 

        // Set the title. 
        a.title = title;  

        // Set the href property. 
        a.href = url;  

        // Append the anchor element to the body. 

  // Send request to the server asynchronously

document.addEventListener('click', function (event) {

	// If the clicked element doesn't have the right selector, bail
	if (!'.refresh a')) return;

	// Don't follow the link

  // Clear holder
  var container = document.querySelector('.holder');
  container.innerHTML = "";
	// Log the clicked element in the console

}, false);