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

              
                <h1 id="title">Cheech & Chong's<BR>Quote Machine</h1>
<div class="quoteBox">
  <div id="quote">
    "Click The Button to Get a New Quote"
  </div>
  <div class="buttons">
<!--    <button type="button" class="myButton" id="tweet">Tweet this quote!</button>
-->
    <a href="https://twitter.com/share?url=https://codepen.io/pharaohlxvi/pen/jyvexW&text=Check%20out%20this%20Cheech%20and%20Chong%20Quote%20Machine:%20" class="myButton" id="tweet" data-show-count="false"  data-size="large">Tweet This Quote</a><script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>  
    
    <button class="myButton" id="newQuote">New Quote!</button>
  </div>
</div>
              
            
!

CSS

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

html {
  box-sizing: border-box;
}

*, *:before, *:after {
  box-sizing: inherit;
}

body {
  background-color: #509CB5;
  font-family: Pangolin, sans-serif;
  text-align: center;
}

#title {
  color: #0A4357;
  font-size: 4em;
}

/* QUOTE BOX */

.quoteBox {
  margin: 0 auto;
  width: 50%;
  height: 30%;
  background-color: #DECD8C;
  border-radius: 10px;
}

#quote {
  padding: 50px;
  font-size: 2em;
}

.buttons {
  display: inline-block;
  margin: 0 auto;
  width: 80%;
  padding: 0 0 20px 0;
}

#tweet {
  float: left;
}

#newQuote {
  float: right;
}

.myButton {
	background-color:#007dc1;
	-moz-border-radius:7px;
	-webkit-border-radius:7px;
	border-radius:7px;
	border:4px solid #124d77;
	display:inline-block;
	cursor:pointer;
	color:#ffffff;
	font-family:Courier New;
	font-size:13px;
	padding:6px 24px;
	text-decoration:none;
	text-shadow:0px 1px 0px #154682;
}
.myButton:hover {
	background-color:#0061a7;
}
.myButton:active {
	position:relative;
	top:1px;
}

              
            
!

JS

              
                var colors = ['#DECD8C', '#509CB5', '#D4A190', '#BFE0B4', '#DE85A3', '#5C5A07', '#8082BD', '#BD80A1'];

var quotes = ['The smartest billionaires I know never finished high school. I got my degree and my doctorate on the street and an advanced degree in jail.', 'Everything that happens to me is very cosmic.', 'But you can\'t exercise and be high. It\'s impossible.', '- Hey, man, don\'t take those!<br>- What?', 'Hey, what was that shit, man?', 'I hope you are not busy for about a month, man!', '- Hey, man, how am i driving?<br>- I think we are parked, man!', 'That\'s some heavy shit!'];

window.onload = function() {
  var quoteDiv = document.getElementById("quote");
  var clickNew = document.getElementById("newQuote");
  
  function changeQuote() {
    var whichColor = Math.floor(Math.random() * colors.length);
    var whichQuote = Math.floor(Math.random() * quotes.length);
    quoteDiv.innerHTML = "\"" + quotes[whichQuote] + "\"";
    document.body.style.backgroundColor = colors[whichColor];
    quoteBox.style.backgroundColor = colors[whichColor];
  }
  
  clickNew.addEventListener("click", changeQuote);
};
              
            
!
999px

Console