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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                    <div class="container-fluid main">
        <div class="row">
            <div class="col-lg-6 col-md-8 col-sm-10 col-xs-12 center main-box">
                <h1>Random Quote Generator <button class="btn btn-primary btn-lg" id="quote-button"><i class="fa fa-refresh"></i> New Quote</button></h1>

                <i id="left-quote" class="fa fa-quote-left fa-3x fa-pull-left"></i>
                <h3 id="quote-box"></h3>
                <a class="btn btn-primary btn-lg" id="tweet-quote" title="Tweet this quote!" target="_blank"><i class="fa fa-twitter"></i> Tweet</a>

                <br>

            </div>
        </div>
    </div>
              
            
!

CSS

              
                * {
// border: 1px red dashed;
}



body {
 background: grey;
}

.container-fluid {
}

.main-box {
background: orange;
 margin: 50px;
 border: 5px black solid;
 padding: 10px;
}

#left-quote {
/*   margin-top: 30px; */
}

.center {
 float: none;
 margin-left: auto;
 margin-right: auto;
}

#quote-box {
 padding: 0 0 10px 0;
}


#tweet-quote {
/*   display: inline-block;
 border: 2px solid blue;
 border-radius: 5px;
 height: 30px;
 font-color: #fff; */
 display: block;
 width: 110px;
 margin-top: 50px;

}

#quote-button {
   float: right;
   display: inline;

}

              
            
!

JS

              
                var quotes = [
  "You can do anything, but not everything. - David Allen",
  "You miss 100 percent of the shots you never take. - Wayne Gretzky",
  "We’ve heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true. - Robert Wilensky",
  "Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover. - H. Jackson Brown Jr.",
  "A life unexamined is not worth living - Socrates",
  "Question authority - they don’t have a clue what they’re doing either, despite how confident they appear.",
  "Rules are for fools - Douglas Bader",
  "Dont wait. The time will never be just right. - Napolean Hill",
  "If you want to go fast, go alone. If you want to go far, go together. – African Proverb",
  "Discipline equals freedom. - Jocko Willink",
  "The wisdom of life consists in the elimination of nonessentials. - Lin Yutang",
  "Ignorance more frequently begets confidence than does knowledge. - Charles Darwin",
  "What did you learn in schoold that you still use today? Go ahead teachers, tell me. What? Fear, conformity, don't question authority... - Doug Stanhope",
  "Just because you're offended, doesn't mean you're right - Ricky Gervais"

]

function randomQuote() {
  return quotes[Math.floor(Math.random() * quotes.length)];
}


$(document).ready(function() {

  // On intitial page load...

  // generate random quote
  var item = randomQuote();
  // apply quote to the quote box
  $("#quote-box").text(item);
  // apply the corect url to pre-populate the twitter tweet box
  $('tweet-quote').attr('href', 'https://twitter.com/intent/tweet?text='+item);


  // On clicking the Quote button
  $('#quote-button').on('click', function() {
    // create new random quote
    var item = randomQuote();
    // apply quote to the quote box
    $("#quote-box").text(item);
    // apply the corect url to pre-populate the twitter tweet box
    $('#tweet-quote').attr('href', 'https://twitter.com/intent/tweet?text='+item).attr('target', '_blank');
    });

});



              
            
!
999px

Console