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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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>Quote App</title>
    <meta charset='UTF-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <meta name='viewport' content='width=device-width, initial-scale=1, shrink-to-fit=no'>

    <link href="https://fonts.googleapis.com/css?family=Coda" rel="stylesheet">
    <link rel="stylesheet" href="main.css">
</head>

<body>
    <div id="background">
        <div id="progress">
            <div id="loadBar"></div>
        </div>

        <div class="loading"></div>
        
        <div class='quoteWrapper'>

            <svg class="img" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="50px" height="50px" viewBox="0 0 100 99.999" enable-background="new 0 0 100 99.999" xml:space="preserve">
            <polygon points="22.468,62.178 41.67,62.178 41.67,99.123 1.254,99.123 1.254,62.178 27.432,21.735 "/>
            <polygon points="79.676,62.178 98.877,62.178 98.877,99.123 58.462,99.123 58.462,62.178 84.639,21.735 "/>
            </svg>
            <div class='text'>
                <p class="content">Technology has moved away from sharing and toward ownership. This suits software and hardware companies just fine: They create new, bloated programs that require more disk space and processing power. We buy bigger, faster computers, which then require more complex operating systems, and so on.  This suits software and hardware companies just fine:  This suits software and hardware companies just fine: </p>
                <h6 class="sig">Douglas Rushkoff</h6>
            </div>
            
            <div id="getMessage">
                <svg id="refresh" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
                     width="48px" height="48px" viewBox="0 0 48 48" enable-background="new 0 0 48 48" xml:space="preserve">
                <path fill="none" stroke="#000000" stroke-miterlimit="10" d="M28.985,39.998c-1.168,0.33-2.373,0.527-3.586,0.585"/>
                <path fill="none" stroke="#000000" stroke-miterlimit="10" d="M35.071,36.818c-1.122,0.913-2.357,1.687-3.672,2.291"/>
                <path fill="none" stroke="#000000" stroke-miterlimit="10" d="M39.258,31.885c-0.627,1.1-1.375,2.13-2.224,3.069"/>
                <path fill="none" stroke="#000000" stroke-miterlimit="10" d="M41.417,25.558c-0.201,1.436-0.579,2.845-1.123,4.188"/>
                <path fill="none" stroke="#000000" stroke-miterlimit="10" d="M9.167,24C9.164,15.049,16.779,7.25,25.783,7.25
                    c8.583,0,15.739,7.289,15.8,15.8"/>
                <polyline id="dyclr1" fill="none" stroke="#000000" stroke-miterlimit="10" points="4.605,19.757 9.131,24.368 14.606,19.758 "/>
                </svg>
                <span>
                    <svg id="twitter" version="1.1" id="Layer_3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	 width="48px" height="48px" viewBox="0 0 48 48" enable-background="new 0 0 48 48" xml:space="preserve">
                    <g>
                        <g>
                            <path id="dyclr2" fill="#010101" d="M43.225,13.362c-0.189-0.189-0.507-0.252-0.76-0.189L41.2,13.616c0.761-0.886,1.265-1.834,1.583-2.718
                                c0.125-0.317,0.063-0.569-0.129-0.76c-0.189-0.188-0.505-0.252-0.759-0.126c-1.769,0.759-3.284,1.391-4.551,1.77
                                c0,0.063-0.064,0-0.128,0c-1.01-0.568-3.474-1.833-5.246-1.833c-4.488,0.063-8.09,3.855-8.09,8.472v0.252
                                c-6.574-1.266-10.177-3.161-14.097-7.27l-0.631-0.632l-0.379,0.758c-2.149,4.109-0.633,7.839,1.832,10.366
                                c-1.138-0.189-1.896-0.568-2.592-1.137c-0.252-0.188-0.568-0.252-0.884-0.063c-0.252,0.127-0.379,0.506-0.316,0.822
                                c0.884,2.97,3.097,5.375,5.499,6.824c-1.138,0-2.087-0.124-3.034-0.755c-0.252-0.128-0.631-0.128-0.884,0.064
                                c-0.254,0.186-0.38,0.504-0.254,0.816c1.138,3.225,3.352,4.936,6.891,5.379c-1.833,1.07-4.235,1.957-7.965,2.021
                                c-0.379,0-0.694,0.251-0.822,0.567c-0.126,0.378,0,0.696,0.253,0.948c2.276,1.833,7.333,2.908,13.59,2.908
                                c11.126,0,20.228-9.925,20.228-22.125v-0.189c1.391-0.696,2.531-2.023,3.098-3.856C43.478,13.868,43.413,13.552,43.225,13.362z
                                 M39.432,16.966l-0.38,0.126v1.074c0,11.503-8.532,20.861-18.964,20.861c-5.752,0-9.608-0.948-11.693-1.962
                                c4.361-0.315,6.889-1.703,8.85-3.22l1.58-1.141h-1.896c-3.603,0-5.815-1.014-7.08-3.413c1.138,0.378,2.338,0.378,3.667,0.318
                                c0.506-0.064,1.011-0.064,1.517-0.064l0.189-1.265c-2.402-0.695-5.246-2.846-6.637-5.752c1.265,0.568,2.655,0.694,3.919,0.694
                                h1.959l-1.58-1.138c-1.327-0.948-5.247-4.299-3.35-9.103c4.046,3.983,7.901,5.816,14.855,7.08l0.757,0.128v-1.769
                                c0-3.921,3.033-7.144,6.829-7.207c1.451-0.064,3.855,1.263,4.549,1.642c0.38,0.191,0.758,0.254,1.138,0.127
                                c0.951-0.316,2.087-0.758,3.351-1.264c-0.568,0.948-1.326,1.833-2.337,2.654c-0.252,0.189-0.317,0.569-0.19,0.885
                                c0.128,0.316,0.505,0.443,0.823,0.316l2.464-0.822C41.327,15.575,40.633,16.522,39.432,16.966z"/>
                        </g>
                    </g>
                    </svg>
                </span>
            </div>
        </div>
        
        <div><p id="dev">Coded by Swainson Holness</p></div>
    </div>

    
    <script src="main.js"></script>
</body>

</html>
              
            
!

CSS

              
                body {
  margin: 0px;
  font-family: "Coda", cursive;
}

#background {
  min-width: 100vw;
  min-height: 100vh;
  background: linear-gradient(
    to bottom right,
    rgb(220, 120, 120) 19%,
    rgb(220, 220, 119) 82%
  );

  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 10px 1fr 30px;
}

.loading {
  align-self: center;
  justify-self: center;
  border: 8px solid rgba(255, 255, 255, 0.2);
  border-top: 8px solid rgb(225, 225, 225);
  border-radius: 50%;
  width: 100px;
  height: 100px;
  animation: spin 2s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

#progress {
  width: 100vw;
  height: 7px;
  background-color: grey;
  /*    opacity: 0;*/
}

#loadBar {
  padding: 0px;
  margin: 0px;
  width: 0%;
  height: 7px;
  background-color: rgb(157, 186, 232);
  transition: all 0.3s;
}

.quoteWrapper {
  align-self: center;
  justify-self: center;
  width: 300px;
  height: auto;
  background-color: rgba(255, 255, 255, 1);
  -webkit-box-shadow: 34px 29px 47px -15px rgba(0, 0, 0, 0.21);
  -moz-box-shadow: 34px 29px 47px -15px rgba(0, 0, 0, 0.21);
  box-shadow: 34px 29px 47px -15px rgba(0, 0, 0, 0.21);
  word-wrap: break-word;
  max-height: 0px;
  overflow: hidden;
  opacity: 0.1;
  transition: 1s all;
  -webkit-border-radius: 5px;
  -moz-border-radius: 5px;
  border-radius: 5px;
}

.img {
  padding-left: 10px;
}

.text {
  height: auto;
  /*
    padding-bottom: 20px;
    margin: 0px;
*/
}

.sig {
  margin: 0;
  text-align: center;
  margin-left: 15px;
  margin-right: 15px;
  margin-bottom: 30px;
  margin-top: 0px;
}

.content {
  padding: 0px;
  margin-left: 15px;
  margin-right: 15px;
  margin-bottom: 10px;
  margin-top: 10px;
  height: auto;

  text-align: center;
}

#getMessage {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

#refresh {
  justify-self: end;
  margin-right: 20px;
  cursor: pointer;
}

#twitter {
  margin-left: 20px;
  cursor: pointer;
}

#refresh:hover,
#twitter:hover {
  opacity: 0.4;
}

#dev {
  color: white;
  font-size: 0.6em;
  padding-left: 10px;
  margin-top: 10px;
  opacity: 0;
}

@media screen and (min-width: 566px) {
  .quoteWrapper {
    width: 420px;
  }
}

@media screen and (min-width: 768px) {
  .quoteWrapper {
    width: 620px;
  }
  .content {
    font-size: 1em;
  }
}

@media screen and (min-width: 1200px) {
  .quoteWrapper {
    width: 620px;
  }
  .content {
    font-size: 1.4em;
  }
  .sig {
    font-size: 1em;
  }
  .img {
    width: 70px;
    height: 70px;
  }
}

              
            
!

JS

              
                window.onload = function() {
  function getRandomIntInclusive(min, max) {
    return Math.floor(Math.random() * (max - min + 1)) + min;
  }

  //---------------------------------------------------
  // animated gradient background - Swainson Holness
  //---------------------------------------------------
  var bck = document.getElementById("background");
  var lcol;
  var rcol;
  var token = 0;
  var angToken = -90;
  var tendency = false;
  var colorleft = "rgb(220, 120, 120)";
  var colorRight = "rgb(220, 220, 119)";

  function toggle() {
    if (token === 99) {
      tendency = true;
    } else if (token === 1) {
      tendency = false;
    }
  }

  function run() {
    if (tendency === false) {
      token += 1;
      angToken += 1;
    } else if (tendency === true) {
      token -= 1;
      return angToken - 1;
    }
  }

  setInterval(function() {
    toggle();
    run();

    var leftcolor = token + 0;
    var rightcolor = token + 100;

    // animation cycles through gradient location and angle degrees.
    bck.style.background =
      "linear-gradient(" + angToken + "deg, " +
      colorleft +
      " " +
      leftcolor +
      "%, " +
      colorRight +
      " " +
      rightcolor +
      "%)";
  }, 14);
  //---------------------------------------------------
  // END
  //---------------------------------------------------

  // api call, must use "https"!
  var dataPackage = {};
  dataPackage.quoteArr = [];
  var quote = dataPackage.quoteArr;
  var pgload = 1;
  var loadPer = 0;

  function pasteContent() {
    var tempNum = getRandomIntInclusive(0, 25);
    $(".content").text(quote[tempNum].body);
    $(".sig").text(quote[tempNum].author);
  }

  //====================
  // RENDER TO DOM
  //====================
  function render() {
    $(".quoteWrapper").animate(
      {
        opacity: 1
      },
      {
        duration: 500,
        complete: function() {
          pasteContent();

          $("#background").css("grid-template-rows", "1fr");
          $(".content").css("color", colorleft);
          $(".sig").css("color", colorleft);
          $(".img").css("fill", colorleft);
          $("#dyclr1").css("stroke", colorleft);
          $("#refresh path").css("stroke", colorleft);
          $("#dyclr2").css("fill", "#00aced");
          $(".quoteWrapper").css(
            "maxHeight",
            $(".content").outerHeight() +
              $(".img").outerHeight() +
              $(".sig").outerHeight() +
              $("#getMessage").outerHeight() +
              54
          );
          $(".sig").animate(
            {
              opacity: 1
            },
            {
              duration: 500
            }
          );
          $("#dev").animate(
            {
              opacity: 0.7
            },
            {
              duration: 500
            }
          );
        }
      }
    );
  }

  // Get quotes
  dataPackage.loadContent = function(tag, pgNum) {
    $.ajax({
      url:
        "https://favqs.com/api/quotes/?filter=" +
        tag +
        "&type=tag&page=" +
        pgNum,
      headers: {
        Authorization: 'Token token="ef2942516afa8711bbff0c4ba1c59a0d"'
      }
    })
      .done(function(data) {
        for (var i = 0; i < 25; i++) {
          quote.push({
            body: data.quotes[i].body,
            author: data.quotes[i].author
          });
        }
        if (pgload <= 2) {
          pgload += 1;
          loadPer += 50.;
          dataPackage.loadContent("life", pgload);
          $("#loadBar").css("width", loadPer + "%");
        } else {
          $("#progress").fadeOut();
          $(".loading").fadeOut(function() {
            render();
          });
        }
      })
      .fail(function() {
        console.log("FAIL");
      });
  };

  //    initialize program
  dataPackage.loadContent("science", pgload);

  document.getElementById("refresh").addEventListener("click", function(e) {
    e.preventDefault();
    colorleft =
      "rgb(" +
      getRandomIntInclusive(100, 220) +
      ", " +
      getRandomIntInclusive(100, 220) +
      ", " +
      getRandomIntInclusive(100, 220) +
      ")";
    colorRight =
      "rgb(" +
      getRandomIntInclusive(120, 220) +
      ", " +
      getRandomIntInclusive(120, 220) +
      ", " +
      getRandomIntInclusive(120, 220) +
      ")";

    $(".content").css("color", colorleft);
    $(".sig").css("color", colorleft);
    $(".img").css("fill", colorleft);
    $("#dyclr1").css("stroke", colorleft);
    $("#refresh path").css("stroke", colorleft);

    $(".content").css("opacity", "0");
    $(".sig").css("opacity", "0");
    $(".quoteWrapper").css("height", $(".quoteWrapper").outerHeight());
    pasteContent();
    $(".quoteWrapper").css(
      "height",
      $(".content").outerHeight() +
        $(".img").outerHeight() +
        $(".sig").outerHeight() +
        $("#getMessage").outerHeight() +
        54
    );
    $(".quoteWrapper").css(
      "maxHeight",
      $(".content").outerHeight() +
        $(".img").outerHeight() +
        $(".sig").outerHeight() +
        $("#getMessage").outerHeight() +
        54
    );
    setTimeout(function() {
      $(".sig").animate(
        {
          opacity: 1
        },
        {
          duration: 500
        }
      );
      $(".content").animate(
        {
          opacity: 1
        },
        {
          duration: 500
        }
      );
    }, 250);
  });
  document.getElementById("twitter").addEventListener("click", function(e) {
    window.open(
      "https://twitter.com/intent/tweet?text=" +
        $(".content").text() +
        " Author: " +
        $(".sig").text(),
      "_blank"
    );
  });
  window.addEventListener("resize", function() {
    setTimeout(function() {
      $(".quoteWrapper").css("height", $(".quoteWrapper").outerHeight());
      $(".quoteWrapper").css(
        "height",
        $(".content").outerHeight() +
          $(".img").outerHeight() +
          $(".sig").outerHeight() +
          $("#getMessage").outerHeight() +
          54
      );
      $(".quoteWrapper").css(
        "maxHeight",
        $(".content").outerHeight() +
          $(".img").outerHeight() +
          $(".sig").outerHeight() +
          $("#getMessage").outerHeight() +
          54
      );
    }, 1300);
  });
};

              
            
!
999px

Console