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

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

              
                 <title>Great Quote's</title>
<div class="box">

  <div id="quoteDisplay">
    <!-- quotes display here -->
  </div>
  
  <a id="tweet-quote" title="Tweet this quote!">
  <i class="fa fa-twitter-square tweet" aria-hidden="true"></i>
  </a>

  <button onclick="newQuote()" class="button">New Quote</button>
</div>


<p><a href="https://www.linkedin.com/in/matthew-underwood/" target="_blank">by Matt Underwood</a></p>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Baloo+Bhaijaan');

@import url('https://fonts.googleapis.com/css?family=Mukta');

@import url('https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz');
 
body {
  background-color: green;
  font-family: 'Yanone Kaffeesatz', sans-serif;
}

.box { 
  background-color: white;
  width: 550px;
  height: 225px;
  margin-left: auto;
  margin-right: auto;
  margin-top: 8%;
}

#quoteDisplay {
  font-size: 36px;
  margin-left: 20px;
  margin-right: 20px;
  padding-bottom: 20px;
  text-align: center;
  padding-top: 50px;

}

.button {
  width: 8em;
  height: 3em;
  font-size: 16px;
  float: right;
  margin-right: 30px;
  margin-top: 3px;
  position: relative;
  color: white;
  background-color: green;
  cursor: pointer;
  outline: none;
  border: white;
}

.tweet {
  color: green;
  font-size: 3em;
  padding-left: 40px;
  margin-top: 7px;
  position:relative;
  float: left;
  cursor: pointer;
}

p {
  text-align: center;
  font-size: 24px;
  margin-top: 20px;
}
a {
  color: white;
  text-decoration: none;
}

.changeBackgroundColor {
  background: #1f398f;
}

.changeColor {
  color: #1f398f;
}

              
            
!

JS

              
                var quotes = [
  "\"Don't cry because it's over, smile because it happened.\" - Dr. Seuss",
  "\"Behind every great man is a woman rolling her eyes.\" - Jim Carrey",
  "\"An investment in knowledge pays the best interest.\" - Benjamin Franklin",
  "\"My fake plants died because I did not pretend to water them.\" - Mitch Hedberg",
  "\"Age is something that doesn't matter, unless you are a cheese.\" - Luis Bunuel",
  "\"Be yourself; everyone else is already taken.\" - Oscar Wilde",
  "\"Life is hard. After all, it kills you.\" - Katharine Hepburn",
  "\"I'm sorry, if you were right, I'd agree with you.\" - Robin Williams",
  "\"I refuse to join any club that would have me as a member.\" - Groucho Marx",
  "\"A committee is a group that keeps minutes and loses hours.\" - Milton Berle"
]

function yourfunction() { /* do stuff on page load */ }
window.onload = newQuote;

function newQuote() {
var randomNumber = Math.floor(Math.random() * (quotes.length));
document.getElementById("quoteDisplay").innerHTML = quotes[randomNumber];
}

//generate random color and change to it on click

//shake button when clicked and change color of body and button
$(".button").click(function() {
  $(this).effect( "shake", {direction: "down", times: 1, distance: 4}, 300);
  $(".button, body").toggleClass("changeBackgroundColor");
});

//change color of twitter logo on button click
$(".button").click(function() {
  $(".tweet").toggleClass("changeColor");
 });

$('#tweet-quote').click(function() {
      window.open('https://twitter.com/intent/tweet?text=' + $("#quoteDisplay").text()); 
});


              
            
!
999px

Console