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 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

              
                <script>window.twttr = (function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0],
    t = window.twttr || {};
  if (d.getElementById(id)) return t;
  js = d.createElement(s);
  js.id = id;
  js.src = "https://platform.twitter.com/widgets.js";
  fjs.parentNode.insertBefore(js, fjs);
 
  t._e = [];
  t.ready = function(f) {
    t._e.push(f);
  };
 
  return t;
}(document, "script", "twitter-wjs"));</script>
<h1>Yogi Berra Quote Randomizer</h1>
<p>Quotes from my favorite quote generator, the late Yogi Berra.</p>
<button onclick="randomQuote()">Show a random quote...</button>
<hr />
<h3 class="example-right"><span id="quote">&nbsp;</span></h3>
<p>-Yogi Berra</p>
<div id="tweet-button"></div>
              
            
!

CSS

              
                body {
  margin: 2em;
}

.example-right {
  position:relative;
  padding:15px 30px;
  margin:0;
  color:#fff;
  background:#5a8f00; /* default background for browsers without gradient support */
  /* css3 */
  background:-webkit-gradient(linear, 0 0, 0 100%, from(#b8db29), to(#5a8f00));
  background:-moz-linear-gradient(#b8db29, #5a8f00);
  background:-o-linear-gradient(#b8db29, #5a8f00);
  background:linear-gradient(#b8db29, #5a8f00);
  -webkit-border-radius:10px;
  -moz-border-radius:10px;
  border-radius:10px;
}

/* display of quote author (alternatively use a class on the element following the blockquote) */
.example-right + p {margin:15px 0 2em 85px; font-style:italic;}

/* creates the triangle */
.example-right:after {
  content:"";
  position:absolute;
  bottom:-50px;
  left:50px;
  border-width:0 20px 50px 0px;
  border-style:solid;
  border-color:transparent #5a8f00;
  /* reduce the damage in FF3.0 */
  display:block;
  width:0;
}

              
            
!

JS

              
                function randomQuote() {
  var quotes = [
    "If you don't know where you are going, you might wind up someplace else.",
"You can observe a lot by watching.",
"I never said most of the things I said.",
"You wouldn't have won if we'd beaten you.",
"Baseball is ninety percent mental and the other half is physical.",
"In theory there is no difference between theory and practice. In practice there is.",
"If the world were perfect, it wouldn't be.",
"You better cut the pizza in four pieces because I'm not hungry enough to eat six.",
"I liked St. Louis, when they were in the American League, because that was going home. I had all my family and friends there.",
"When you come to a fork in the road, take it."
  ];
  var i = Math.floor(Math.random() * 10);
  $("#quote").text("\""+quotes[i]+"\"");
  $("#tweet-button").empty();
  twttr.widgets.createShareButton(
  'https://codepen.io/MrAusnadian/full/yYPReE/',
  document.getElementById('tweet-button'),
  {
    count: 'none',
    text: "\""+quotes[i]+"\" -Yogi Berra"
  }).then(function (el) {
    console.log("Button created.")
  });
}
              
            
!
999px

Console