css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div id="quote">
  <div id="body">
    <div id='block'>
      <blockquote>
        <p></p>
      </blockquote>
      <div id='name'>
        <p></p>
      </div>
    </div>
    <div id='button'>
      <button name='next' id='next'>
        Next
      </button>
    </div>
  </div>
  <div id="footer">
    <table class="rrssb-buttons clearfix">
      <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
      <td class="rrssb-facebook">
        <a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https://codepen.io/ni8mr/pen/PzzqBB" class="popup">
          <span class="rrssb-icon">
              <svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid" width="29" height="29" viewBox="0 0 29 29"><path d="M26.4 0H2.6C1.714 0 0 1.715 0 2.6v23.8c0 .884 1.715 2.6 2.6 2.6h12.393V17.988h-3.996v-3.98h3.997v-3.062c0-3.746 2.835-5.97 6.177-5.97 1.6 0 2.444.173 2.845.226v3.792H21.18c-1.817 0-2.156.9-2.156 2.168v2.847h5.045l-.66 3.978h-4.386V29H26.4c.884 0 2.6-1.716 2.6-2.6V2.6c0-.885-1.716-2.6-2.6-2.6z" class="cls-2" fill-rule="evenodd"/></svg>
            </span>
        </a>
      </td>
      <td class="rrssb-twitter">
        <a target="_blank" href="https://twitter.com/intent/tweet?text=Quote%20generator%20developed%20by%20%40Ni8mR%20for%20FreeCodeCamp%3A%20http%3A%2F%2Fcodepen.io/ni8mr/pen/PzzqBB%2F" class="popup">
          <span class="rrssb-icon"><svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28"><path d="M24.253 8.756C24.69 17.08 18.297 24.182 9.97 24.62c-3.122.162-6.22-.646-8.86-2.32 2.702.18 5.375-.648 7.507-2.32-2.072-.248-3.818-1.662-4.49-3.64.802.13 1.62.077 2.4-.154-2.482-.466-4.312-2.586-4.412-5.11.688.276 1.426.408 2.168.387-2.135-1.65-2.73-4.62-1.394-6.965C5.574 7.816 9.54 9.84 13.802 10.07c-.842-2.738.694-5.64 3.434-6.48 2.018-.624 4.212.043 5.546 1.682 1.186-.213 2.318-.662 3.33-1.317-.386 1.256-1.248 2.312-2.4 2.942 1.048-.106 2.07-.394 3.02-.85-.458 1.182-1.343 2.15-2.48 2.71z"/></svg></span>
        </a>
      </td>
      <td class="rrssb-linkedin">
        <a target="_blank" href="https://www.linkedin.com/shareArticle?mini=true&amp;url=https://codepen.io/ni8mr/pen/PzzqBB&amp;title=Quote%20to%20generator&amp;summary=quote%20generator%20for%20FreeCodeCamp" class="popup">
          <span class="rrssb-icon">
              <svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28">
                <path d="M25.424 15.887v8.447h-4.896v-7.882c0-1.98-.71-3.33-2.48-3.33-1.354 0-2.158.91-2.514 1.802-.13.315-.162.753-.162 1.194v8.216h-4.9s.067-13.35 0-14.73h4.9v2.087c-.01.017-.023.033-.033.05h.032v-.05c.65-1.002 1.812-2.435 4.414-2.435 3.222 0 5.638 2.106 5.638 6.632zM5.348 2.5c-1.676 0-2.772 1.093-2.772 2.54 0 1.42 1.066 2.538 2.717 2.546h.032c1.71 0 2.77-1.132 2.77-2.546C8.056 3.593 7.02 2.5 5.344 2.5h.005zm-2.48 21.834h4.896V9.604H2.867v14.73z"
                />
              </svg>
            </span>
        </a>
      </td>
      <td class="rrssb-googleplus">
        <a target="_blank" href="https://plus.google.com/share?url=Check%20out%20a%20quote%20generator%20built%20for%20FreeCodeCamp%20https://codepen.io/ni8mr/pen/PzzqBB" class="popup">
          <span class="rrssb-icon">
              <svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28">
                <path d="M14.703 15.854l-1.22-.948c-.37-.308-.88-.715-.88-1.46 0-.747.51-1.222.95-1.662 1.42-1.12 2.84-2.31 2.84-4.817 0-2.58-1.62-3.937-2.4-4.58h2.098l2.203-1.384h-6.67c-1.83 0-4.467.433-6.398 2.027C3.768 4.287 3.06 6.018 3.06 7.576c0 2.634 2.02 5.328 5.603 5.328.34 0 .71-.033 1.083-.068-.167.408-.336.748-.336 1.324 0 1.04.55 1.685 1.01 2.297-1.523.104-4.37.273-6.466 1.562-1.998 1.187-2.605 2.915-2.605 4.136 0 2.512 2.357 4.84 7.288 4.84 5.822 0 8.904-3.223 8.904-6.41.008-2.327-1.36-3.49-2.83-4.73h-.01zM10.27 11.95c-2.913 0-4.232-3.764-4.232-6.036 0-.884.168-1.797.744-2.51.543-.68 1.49-1.12 2.372-1.12 2.807 0 4.256 3.797 4.256 6.24 0 .613-.067 1.695-.845 2.48-.537.55-1.438.947-2.295.95v-.003zm.032 13.66c-3.62 0-5.957-1.733-5.957-4.143 0-2.408 2.165-3.223 2.91-3.492 1.422-.48 3.25-.545 3.556-.545.34 0 .52 0 .767.034 2.574 1.838 3.706 2.757 3.706 4.48-.002 2.072-1.736 3.664-4.982 3.648l.002.017zM23.254 11.89V8.52H21.57v3.37H18.2v1.714h3.367v3.4h1.684v-3.4h3.4V11.89"
                />
              </svg>
            </span>
        </a>
      </td>
    </table>
  </div>
</div>
            
          
!
            
              body {
  background-color: #000000;
}

div#quote {
  width: 650px;
  height: 350px;
  position: relative;
  float: left;
  background-color: #ffffff;
  font-style: Serif
}

div#body {
  width: 100%;
  height: 250px;
  position: relative;
  float: left
}

div#block {
  width: 100%;
  height: 200px;
  float: left
}

div#name {
  position: relative;
  float: right;
  margin-right: 100px;
}

div#button {
  width: 100%;
  height: 50px;
  float: left;
  margin-left: 15em
}

div#footer {
  width: 100%;
  height: 50px;
  position: relative;
  float: left;
  clear: left
}

button[name='next'] {
  width: 10em;
  height: 3.5em;
  background-color: #808080;
  color: #ffffff;
  text-align: center
}

blockquote {
  padding: 0 60px;
  padding: 10px;
  padding-left: 55px;
}

blockquote:before {
  display: block;
  font-size: 700%;
  content: "\201C";
  height: 1px;
  margin-left: -0.55em;
  position: relative;
  top: -20px;
}

.rrssb-buttons {
  box-sizing: border-box;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  height: 36px;
  margin: 0;
  padding: 0;
  width: 100%;
}

.rrssb-buttons:after {
  clear: both
}

.rrssb-buttons:after,
.rrssb-buttons:before {
  content: ' ';
  display: table;
}

.rrssb-buttons li {
  box-sizing: border-box;
  float: left;
  height: 100%;
  line-height: 13px;
  list-style: none;
  margin: 0;
  padding: 0 2px;
}

.rrssb-buttons li.rrssb-facebook a {
  background-color: #306199;
}

.rrssb-buttons li.rrssb-facebook a:hover {
  background-color: #244872;
}

.rrssb-buttons li.rrssb-linkedin a {
  background-color: #007bb6;
}

.rrssb-buttons li.rrssb-linkedin a:hover {
  background-color: #005983;
}

.rrssb-buttons li.rrssb-twitter a {
  background-color: #26c4f1;
}

.rrssb-buttons li.rrssb-twitter a:hover {
  background-color: #0eaad6;
}

.rrssb-buttons li.rrssb-googleplus a {
  background-color: #e93f2e;
}

.rrssb-buttons li.rrssb-googleplus a:hover {
  background-color: #ce2616;
}

.rrssb-buttons li a {
  background-color: #ccc;
  border-radius: 2px;
  box-sizing: border-box;
  display: block;
  font-size: 11px;
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  font-weight: 700;
  height: 100%;
  padding: 11px 7px 12px 27px;
  position: relative;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  -webkit-transition: background-color .2s ease-in-out;
  transition: background-color .2s ease-in-out;
  width: 100%
}

.rrssb-buttons li a .rrssb-icon {
  display: block;
  l eft: 10px;
  padding-top: 9px;
  position: absolute;
  top: 0;
  width: 10%;
}

.rrssb-buttons li a .rrssb-icon svg {
  height: 17px;
  width: 17px;
}

.rrssb-buttons li a .rrssb-icon svg path,
.rrssb-buttons li a .rrssb-icon svg polygon {
  fill: #fff;
}

.rrssb-buttons li a:active {
  box-shadow: inset 1px 3px 15px 0 rgba(22, 0, 0, .25);
}

.rrssb-buttons li.small a {
  padding: 0;
}

.rrssb-buttons li.small a .rrssb-icon {
  left: auto;
  margin: 0 auto;
  overflow: hidden;
  position: relative;
  top: auto;
  width: 100%;
}

.rrssb-buttons li.small a .rrssb-text {
  visibility: hidden;
}

.rrssb-buttons.large-format,
.rrssb-buttons.large-format li {
  height: auto;
}

.rrssb-buttons.large-format li:first-child:nth-last-child(1) a {
  font-size: 20px;
  font-size: 4vw
}

.rrssb-buttons.large-format li:first-child:nth-last-child(2) a,
.rrssb-buttons.large-format li:first-child:nth-last-child(2)~li a {
  font-size: 16px;
  font-size: 2vw;
}

.rrssb-buttons.large-format li:first-child:nth-last-child(3) a,
.rrssb-buttons.large-format li:first-child:nth-last-child(3)~li a {
  font-size: 14px;
  font-size: 1.7vw;
}

.rrssb-buttons.large-format li:first-child:nth-last-child(4) a,
.rrssb-buttons.large-format li:first-child:nth-last-child(4)~li a {
  font-size: 13px;
  font-size: 1.4vw;
}

.rrssb-buttons.large-format li:first-child:nth-last-child(5) a,
.rrssb-buttons.large-format li:first-child:nth-last-child(5)~li a {
  font-size: 13px;
  font-size: 1.2vw;
}

.rrssb-buttons.large-format li:first-child:nth-last-child(6) a,
.rrssb-buttons.large-format li:first-child:nth-last-child(6)~li a {
  font-size: 12px;
  font-size: 1.05vw;
}

.rrssb-buttons.large-format li:first-child:nth-last-child(7) a,
.rrssb-buttons.large-format li:first-child:nth-last-child(7)~li a {
  font-size: 11px;
  font-size: .9vw;
}

.rrssb-buttons.large-format li:first-child:nth-last-child(8) a,
.rrssb-buttons.large-format li:first-child:nth-last-child(8)~li a {
  font-size: 11px;
  font-size: .8vw;
}

.rrssb-buttons.large-format li:first-child:nth-last-child(9) a,
.rrssb-buttons.large-format li:first-child:nth-last-child(9)~li a {
  font-size: 11px;
  font-size: .7vw;
}

.rrssb-buttons.large-format li:first-child:nth-last-child(10) a,
.rrssb-buttons.large-format li:first-child:nth-last-child(10)~li a {
  font-size: 11px;
  font-size: .6vw;
}

.rrssb-buttons.large-format li:first-child:nth-last-child(11) a,
.rrssb-buttons.large-format li:first-child:nth-last-child(11)~li a {
  font-size: 11px;
  font-size: .5vw;
}

.rrssb-buttons.large-format li a {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: .2em;
  padding: 8.5% 0 8.5% 12%;
}

.rrssb-buttons.large-format li a .rrssb-icon {
  height: 100%;
  left: 7%;
  padding-top: 0;
  width: 12%;
}

.rrssb-buttons.large-format li a .rrssb-icon svg {
  height: 100%;
  position: absolute;
  top: 0;
  width: 100%;
}

.rrssb-buttons.large-format li a .rrssb-text {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.rrssb-buttons.small-format {
  padding-top: 5px;
}

.rrssb-buttons.small-format li {
  height: 80%;
  padding: 0 1px;
}

.rrssb-buttons.small-format li a .rrssb-icon {
  height: 100%;
  padding-top: 0;
}

.rrssb-buttons.small-format li a .rrssb-icon svg {
  height: 48%;
  position: relative;
  top: 6px;
  width: 80%;
}

.rrssb-buttons.tiny-format {
  height: 22px;
  position: relative;
}

.rrssb-buttons.tiny-format li {
  padding-right: 7px;
}

.rrssb-buttons.tiny-format li a {
  background-color: transparent;
  padding: 0;
}

.rrssb-buttons.tiny-format li a .rrssb-icon svg {
  height: 70%;
  width: 100%;
}

.rrssb-buttons.tiny-format li a:active,
.rrssb-buttons.tiny-format li a:hover {
  background-color: transparent;
}

.rrssb-buttons.tiny-format li.rrssb-facebook a .rrssb-icon svg path,
.rrssb-buttons.tiny-format li.rrssb-facebook a .rrssb-icon svg polygon {
  fill: #306199;
}

.rrssb-buttons.tiny-format li.rrssb-facebook a .rrssb-icon:hover .rrssb-icon svg path,
.rrssb-buttons.tiny-format li.rrssb-facebook a .rrssb-icon:hover .rrssb-icon svg polygon {
  fill: #18304b;
}

.rrssb-buttons.tiny-format li.rrssb-tumblr a .rrssb-icon svg path,
.rrssb-buttons.tiny-format li.rrssb-tumblr a .rrssb-icon svg polygon {
  fill: #32506d;
}

.rrssb-buttons.tiny-format li.rrssb-tumblr a .rrssb-icon:hover .rrssb-icon svg path,
.rrssb-buttons.tiny-format li.rrssb-tumblr a .rrssb-icon:hover .rrssb-icon svg polygon {
  fill: #121d27;
}

.rrssb-buttons.tiny-format li.rrssb-linkedin a .rrssb-icon svg path,
.rrssb-buttons.tiny-format li.rrssb-linkedin a .rrssb-icon svg polygon {
  fill: #007bb6;
}

.rrssb-buttons.tiny-format li.rrssb-linkedin a .rrssb-icon:hover .rrssb-icon svg path,
.rrssb-buttons.tiny-format li.rrssb-linkedin a .rrssb-icon:hover .rrssb-icon svg polygon {
  fill: #003650;
}

.rrssb-buttons.tiny-format li.rrssb-twitter a .rrssb-icon svg path,
.rrssb-buttons.tiny-format li.rrssb-twitter a .rrssb-icon svg polygon {
  fill: #26c4f1;
}

.rrssb-buttons.tiny-format li.rrssb-twitter a .rrssb-icon:hover .rrssb-icon svg path,
.rrssb-buttons.tiny-format li.rrssb-twitter a .rrssb-icon:hover .rrssb-icon svg polygon {
  fill: #0b84a6;
}

.rrssb-buttons.tiny-format li.rrssb-googleplus a .rrssb-icon svg path,
.rrssb-buttons.tiny-format li.rrssb-googleplus a .rrssb-icon svg polygon {
  fill: #e93f2e;
}

.rrssb-buttons.tiny-format li.rrssb-googleplus a .rrssb-icon:hover .rrssb-icon svg path,
.rrssb-buttons.tiny-format li.rrssb-googleplus a .rrssb-icon:hover .rrssb-icon svg polygon {
  fill: #a01e11;
}

.rrssb-buttons.tiny-format li.rrssb-youtube a .rrssb-icon svg path,
.rrssb-buttons.tiny-format li.rrssb-youtube a .rrssb-icon svg polygon {
  fill: #df1c31;
}

.rrssb-buttons.tiny-format li.rrssb-reddit a .rrssb-icon svg path,
.rrssb-buttons.tiny-format li.rrssb-reddit a .rrssb-icon svg polygon {
  fill: #8bbbe3;
}

.rrssb-buttons.tiny-format li.rrssb-vk a .rrssb-icon svg path,
.rrssb-buttons.tiny-format li.rrssb-vk a .rrssb-icon svg polygon {
  fill: #4d71a9;
}

.rrssb-buttons.tiny-format li.rrssb-vk a .rrssb-icon:hover .rrssb-icon svg path,
.rrssb-buttons.tiny-format li.rrssb-vk a .rrssb-icon:hover .rrssb-icon svg polygon {
  fill: #2d4263;
}
            
          
!
            
              $(document).ready(function() {
  // Styling
  var body_width = $("body").width();
  var width_for_margin = (body_width - 650) / 2;
  $("div#quote").css("margin-left", width_for_margin);
  $("div#quote").css("margin-top", "100px");
  $("div#block").find("blockquote").find("p").css("color", "black");
  $("div#name").find("p").css("color", "black");

  //Quote json
  var json = {
    "Bertrand Russell": "The whole problem with the world is that fools and fanatics are always so certain of themselves, and wiser people so full of doubts.",
    "Golda Meir": "Don't be so humble - you are not that great.",
    "Saint Thomas More": "Sex and religion are closer to each other than either might prefer.",
    "Albert Einstein": "Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.",
    "Galileo Galilei": "I do not feel obliged to believe that the same God who has endowed us with sense, reason, and intellect has intended us to forgo their use.",
    "Pablo Picasso": "Give me a museum and I'll fill it.",
    "Yogi Berra": "In theory, there is no difference between theory and practice. But in practice, there is.",
    "Oscar Wilde": "The only way to get rid of a temptation is to yield to it.",
    "Friedrich Nietzsche": "There are no facts, only interpretations.",
    "Thomas Henry Huxley": "Try to learn something about everything and everything about something.",
    "Simonides": "Dancing is silent poetry.",
    "H. G. Wells": "Human history becomes more and more a race between education and catastrophe.",
    "Steven Wright": "Black holes are where God divided by zero.",
    "Isaac Asimov": "Life is pleasant. Death is peaceful. It's the transition that's troublesome.",
    "Carl Sagan": "If you want to make an apple pie from scratch, you must first create the universe."
  };

  // JSON for counting
  var json2 = {
    "0": "Bertrand Russell",
    "1": "Golda Meir",
    "2": "Saint Thomas More",
    "3": "Albert Einstein",
    "4": "Galileo Galilei",
    "5": "Pablo Picasso",
    "6": "Yogi Berra",
    "7": "Oscar Wilde",
    "8": "Friedrich Nietzsche",
    "9": "Thomas Henry Huxley",
    "10": "Simonides",
    "11": "H. G. Wells",
    "12": "Steven Wright",
    "13": "Isaac Asimov",
    "14": "Carl Sagan"
  };

  // Generating a default random quote
  var random_number_string = Math.round(Math.random() * 14) + "";
  $.each(json, function(key, value) {
    if (key == json2[random_number_string]) {
      $("div#block").find("blockquote").find("p").text(value);
      $("div#name").find("p").text(key);
    }
  });

  // Next button clicking events
  $("#next").click(function(e) {
    e.preventDefault;
    // Saving current quote
    var current_quoter = $("div#name").find("p").text();
    // Saving json2 keys in another variable
    var json2_keys = Object.keys(json2);
    for (key in json2) {
      if (json2[key] == current_quoter) {
        var index = json2_keys.indexOf(key);
        if (index > -1) {
          json2_keys.splice(index, 1);
        }
      }
    }

    var random_number_string1 = json2_keys[Math.round(Math.random() * json2_keys.length)] + "";

    $.each(json, function(key, value) {
      if (key == json2[random_number_string1]) {
        $("div#block").find("blockquote").find("p").text(value);
        $("div#name").find("p").text(key);
      }
    });
  });

  // Twitter sharing event
  $(".rrssb-twitter").click(function(e) {
    e.preventDefault;
    var quote = $("div#block").find("blockquote").find("p").text().split(' ').join("%20");
    var quoter = "%20-%20" + $("div#name").find("p").text().split(' ').join("%20");
    var href_text = "https://twitter.com/intent/tweet?text=" + quote + quoter;
    $(this).find($('a')).attr("href", href_text);
  });
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console