cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

              <div class="flexbox">
  <div class="quoteBox">
    <div class="quotesArea">
      <p class="text-center intro"><strong>Push the button and get a quote!</strong></p>
    <div class="buttons flexbox">
      <a href="#" id="link" target="_blank"><button class="btn btn-primary" id="twitterQuote" type="submit">Tweet this!</button></a>
      <button class="btn btn-primary" id="nextQuote" type="submit">Next Quote</button>
              /* Make everything prettier */

body {
  margin: 0;
  height: 100%;

.flexbox {
  display: flex;
  justify-content: center;
  align-items: center;
  height: inherit;

.quoteBox {
  background-color: #eee;
  width: 600px;
  height: 300px;
  border: 1px solid #000;

.quotesArea {
  height: 75%;

.quotes {
  padding-top: 30px;

.buttons {
  height: 25%;
  justify-content: space-around;

.intro {
  padding-top: 60px;
              //Important Note: for proper use with this API make sure you prefix your URL with 'http' instead of 'https'

//Missing 1: only request quotes with less than or equal to 140 characters (since Twitter prohibits > 140) OR write a function that cuts the sentence off after 137 characters and adds "..." (actually already done in the "Basic Algorithm" section on FCC)

//Missing 2: When hitting the tweet button, not only the content but also the author's name should be transferred

$(document).ready(function() {
  $('#nextQuote').on('click', function() {
      type: 'GET',

      url: 'https://cors-anywhere.herokuapp.com/https://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1',

      success: function(data) {
        var quote = {
          //Is it okay to already capitalize the properties here for later use in the p-elements as text (see for loop)?
          Author: data[0].title,
          Quote: data[0].content.slice(3, data[0].content.lastIndexOf(".") + 1)
          //Cutting out the p-tags and the carriage return space
        var html = "<div class='quotes text-center'>";

        for (var prop in quote) {
          html += "<p><strong>" + prop.toString() + "</strong></p>";
          html += "<p>" + quote[prop] + "</p>";
        html += "</div>";

      error: function() {

      cache: false,
  $('#twitterQuote').on('click', function() {
    var tweet = $('p:last-of-type').text().split(" ").join("%20");
    //Get the quote without using a global variable. Any more eloquent ideas?
    $("#link").attr("href", "https://twitter.com/intent/tweet?hashtags=quotes&related=freecodecamp&text=" + '"' + tweet + '"');
Loading ..................