Pen Settings



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


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


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.


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.


  <div class="container-fluid">
    <h1 class="text-center">Random Quote Machine</h1>
    <div class="container">
      <div class="row">
        <i class="fa fa-quote-left fa-2x"><span id="text"></span></i>
      <div class="row">
        <span id="author" style="float: right"> </span>
      <div class= "row">
        <a class= "btn" id="twitter" title="Tweet this!">Tweet <i class="fa fa-twitter"></i></a>
        <button class = "btn" id="randomize" title="New quote">Randomize</button>
    <h6>coded by <a href="" id="personal-link"> Kiersten Johnson</a></h6>


                body {
  padding: 60px;
  background-color: #cd6090;
  color: #cd6090;
  font-family: 'Mukta Malar', sans-serif;

.container-fluid {
  min-width: 500px;

  color: #ffffff;
  font-family: 'Lobster', cursive;
  font-size: 48px;

.container {
  background-color: #ffffff;
  border-radius: 10px;
  padding: 20px;
  max-width: 600px;

.row {
  padding-right: 20px;
  padding-left: 20px;

#text {
  font-size: 24px !important;
  font-family: 'Mukta Malar', sans-serif;

#author {
  font-size: 20px;

.btn {
  background-color: #cd6090;
  color: #ffffff;

#randomize {
  float: right !important;

#twitter:hover {
  background-color: #0084b4 !important;
  color: #ffffff;

h6 {
  text-align: right;
  color: #ffffff;

#personal-link {
  color: #ffffff;


                $(document).ready(function() {
    .click(function(event) {
      $("#randomize").css("color", "#ffffff");
      $("#author, #text").fadeOut(600);
      $("#author, #text").fadeIn(600);
      $("h1").effect("bounce", "slow");

This function houses the AJAX call used to retrieve JSON data from a quote API.

function getQuote() {
    cache: false,
    dataType: "json",
    success: function(json) {
        " " + json[0].content.slice(3) + json[0].content.slice(-5)
      $("#author").html("-" + json[0].title);
      $("#twitter").attr("href", primeTweet(json[0].content, json[0].title));

This function primes the JSON quotation into a format functional for Twitter.

function primeTweet(quote, author) {
  quote = '"' + quote.slice(3, quote.length - 5) + '"';
  quote = quote.replace(/&#8211;/g, "-");
  quote = quote.replace(/&#8217;/g, "'");
  quote = quote.replace(/&#8220;/g, '"');
  quote = quote.replace(/&#8221;/g, '"');
  quote += " -" + author;

  if (quote.length > 140) {
    quote = quote.slice(0, 140 - (author.length + 6)) + '..." -' + author;
  return (quote = "" + quote);

This function sets the background color of the page.

function setColor() {
  var color = [
  var index = Math.floor(Math.random() * color.length);
  $("body").css("background-color", color[index]);
  $("body").css("color", color[index]);
  $(".btn").css("background-color", color[index]);