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.


                <body class="container-fluid">
  <div class="wrapper">
    <h1>Thus wrote the Bard...</h1>
    <div class="centered">
        <p id="printQuote"></p>
        <p id="author">- William Shakespeare</p></div>
      <div><img id="button" onclick="generateQuote();" src="" onmouseover="this.src=''" onmouseout="this.src=''"></div>
    </div> <!--Close centered-->
    <div class="push"></div>
  </div> <!--Close wrapper-->
  <div class="footer">Powered by the STANDS4 Web Services <a href="">Quotes API</a></div>


                body {
  height: 100vh;
  text-align: center;
  background: fixed center no-repeat url( "") #cbb385;
  background-size: 100% 100%;
.wrapper {
  min-height: 100vh;
  height: auto !important;
  height: 100vh;
  margin: 0 auto -3em; 
  padding: 1em;
.footer, .push {
  height: 3em; 
Sticky Footer by Ryan Fait
.footer {
  padding: 1em;
  background-color: rgba(203,179,133,0.7);
  font-size: 1.5vmin;
h1 {
  font-family: 'Italianno', Brush Script MT, cursive;
  font-size: 9vmin;
  margin-top: 1em;
  margin-bottom: 5rem;
.centered {
  width: 100%;
  max-width: 70vmax;
  margin: auto;
#printQuote {
  font-family: 'Italianno', Brush Script MT, cursive;
  font-size: 4vmin;
#author {
  font-family: 'Italianno', Brush Script MT, cursive;
  font-size: 3vmin;
#button {
  cursor: pointer;


                var quote, //Stores value of randomly selected quote
    prevQuote, //Stores index of previous quote used
    val, //Stores total length of XML data
    response; //Stores XML data retrieved from API   

function randomNumber(val) { //Generates random value between 0 and length of XML data
  return Math.floor(Math.random() * val);

(function() { //Fetches XML data from API and prints random first quote
  var url =  /*
    * You can
    * apply for your own free key to use this API
    * at
    * Thanks. 
  var randomQuote = new XMLHttpRequest();
  randomQuote.onreadystatechange = function() {
    if (randomQuote.readyState == 4 && randomQuote.status == 200) {
      response = randomQuote.responseXML;
      val = response.getElementsByTagName('quote').length; //Gets length of XML data for random number generating
      generateQuote(); //Runs function to generate first quote once API call completes
  }"GET", url, true);
}) ();

function generateQuote() {      
  var random = randomNumber(val);
  if (random === prevQuote && random === quoteList.length-1) { 
  else if (random === prevQuote) {
  } //Prevents same quote being shown twice in a row
  quote = response.getElementsByTagName('quote')[random];
  document.getElementById("printQuote").innerHTML = quote;
  prevQuote = random; // Saves random number for comparison to avoid repeats