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

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.

HTML

              
                <div class="container-fluid text-center">
  <div class="container-quote">
    <h1><i class="fa fa-quote-left" aria-hidden="true"></i> <span id="quote">Hello World</span></h1>
    <h3 class="by">- <span id="author">v3.3.7</span></h3>
    <hr/>
    <div class="box">
      <a href="#" class="btn btn-twitter" type="button" target="_blank" id="tweet"><i class="fa fa-twitter" aria-hidden="true"></i></a>
      <button class="btn btn-new" type="button" onclick="newQuote()">New Quote</button>
    </div>
  </div>
</div>
              
            
!

CSS

              
                body {
  background-color: #9b9b9b;
}

.container-quote {
  margin: 150px auto;
  padding: 10px;
  border: 1px solid #ecf0f1;
  max-width: 550px;
  border-radius: 7px;
  background-color: white;
  overflow: auto;
}

 .btn-twitter {
  background-color: #bdc3c7;
  color: inherit;
}


.box {
  display: flex;
  justify-content: space-between;
}

.by {
  text-align: right;
}
              
            
!

JS

              
                var quotes = {
  "1":["B. Franklin", "Beware of little expenses. A small leak will sink a great ship."],
  "2":["B. Franklin", "In this world nothing can be said to be certain, except death and taxes."],
  "3":["S. Orman","A big part of financial freedom is having your heart and mind free from worry about the what-ifs of life."],
  "4":["D. Trump","Money was never a big motivation for me, except as a way to keep score. The real excitement is playing the game."],
  "5":["W. Feather","A budget tells us what we can't afford, but it doesn't keep us from buying it."],
  "6":["Winston S. Churchill", "Success is not final, failure is not fatal, It is the courage to continue that counts."],
  "7":["Herman Melville", "It is better to fail in originality than to succeed in imitation."],
  "8":["Colin R. Davis", "The road to success and the road to failure are almost exactly the same."],
  "9":["Henry David Thoreau", "Success usually comes to those who are too busy to be looking for it."],
  "10":["Chris Grosser", "Opportunities don't happen. You create them."],
  "11":["John D. Rockefeller", "Don't be afraid to give up the good to go for the great."],
  "12":["Thomas Jefferson", " find that the harder I work, the more luck I seem to have."]
}

window.onload = function() {
  newQuote();
};

function selecting() {
  return (Math.round(Math.random() * Object.keys(quotes).length)).toString();
}

function newQuote() {
  var select = selecting();
  var quote = quotes[select][1];
  var author = quotes[select][0];
  document.getElementById("quote").innerHTML = quote;
  document.getElementById("author").innerHTML = author;
  var tweetQuote = quote + " - " + author;
  document.getElementById("tweet").setAttribute('href', 'https://twitter.com/intent/tweet?text=' + tweetQuote);
}
              
            
!
999px

Console