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

              
                <div id="quote-box">
  <div id="text">
  <!-- Display quotes here -->  
  </div>
  
  <div id="author">
    <!-- Display authors here -->  
  </div>
      
  <a id="tweet-quote" href='https://twitter.com/intent/tweet?text=' title="Tweet this quote!" target="_blank">
     <img  src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAACF0lEQVRoge2Z3XGjMBRGTwmUoBLcQdyB3cHSgdNB3MGmA9NBtgPTwdIB20HcQfbhooQQYQn5SuKBb+Ybz4CR7kFXv8CmTZs2ZZIBnoDD8PtUNJqFqoAXoAc+HH4HLgikr5yd64bzorKOSKAuAJdfHGUYBPQDR8xmuFErBz7WM+EAY1+QlPsN/B1d/+OrJEXL1JEQc74hqfVD7eSPtSKEYVk6hUDYl10h6fopV0VaMI0iRAf8Ak5Iyr0zyaC5B9+YacJAVYoQLtfTCrs7f+6BfSRInRDi1VVhG/DgG/6xfapzIoh6rsLXBYVcFgAtKTfU3zr3VCaiwCvS8e71oRQgXrUPFH5FZuHDBOxcAsQgY7RWhT3z66lY30JAQPJP+w1quvUB9Hzl+xHdlskK4kqL0kG77Jw7xmpXEGSIn30gsUvs3PauzCvW2y+sg0es8wqCvecmFATW3VfqJSAV91fCJdMqajuRYo2ULa2mMkMBaxgETAzADlkAWl8LQzQxEFZraIWHWsNqLROkd0kSorYwxD8eO/j4VOmheK8BMYYpMRR7F4ex2iNnrTkgmlQQY1UDVKpWanNAWJ3QPcu17lDq3D4dSDc5NqmDN8hevk8EoNaxd3x9u7M+8fOjSgp3KH6LqdA99g/xDdnEJZHJAGQBsnToCslZzRm9Q3Z3WQBc2g0BNCwDa4dnjhQM3ic7IbpsSgS0aVNC/Qd3/sAfi5jQNwAAAABJRU5ErkJggg=="> 
    </img>
  </a>


  <div id="new-quote">
    <button onclick="newQuote()">
      New Quote</button>
  </div>

</div>

<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css2?family=Pangolin&family=Source+Sans+Pro&display=swap');

body{  
  background-color: #16a085;  
}

#quote-box {
  border-radius:3px;
  margin: auto;
  width:450px;
  height:auto;
  padding:50px 20px;
  background-color:#fff;
}

#text {
  text-align: center;
  font-family: 'Pangolin', cursive;   
  font-size: 1.75em;
}
#author {
  text-align: right;
  font-family: 'Source Sans Pro', sans-serif;
  font-size: 1.15em;
  padding: 50px 30px;
}

#tweet-quote{
  float: left;
} 
#new-quote {
  float: right;
}
      
    
  
  
              
            
!

JS

              
                // Initialize array with some quotes
var quotes = [
  {
    quote: "I'm beginnin' to feel like a Rap God, Rap God All my people from the front to the back nod, back nod",
   author:'- Eminem'
  }, 
  {
    quote: "I'm in love with the shape of you We push and pull like a magnet do",
    author: "- Ed Sheeran"
  },
  {
    quote: "Kiki, do you love me? Are you riding? Say you'll never ever leave from beside me 'Cause I want ya, and I need ya And I'm down for you always",
   author: '- Drake'
  }, 
  {
    quote: "I'm gonna pop some tags Only got 20 dollars in my pocket I'm, I'm, I'm huntin', lookin' for a come up This is fucking awesome",
   author: '- Wanz'
  }, 
  {
    quote: 'Real G\'s move in silence like lasagna',
   author: '- Lil Wayne'
  }, 
  {
    quote: 'If I told you that a flower bloomed in a dark room, would you trust it ?', 
   author: '- Kendrick'
  }, 
  {
    quote: 'Ayo, I break bread, ribs, hundred dollar bills',
    author: '- Prodigy'
  },
  {
    quote: 'I want something just like this Doo-doo-doo, doo-doo-doo. Doo-doo-doo, doo-doo. Doo-doo-doo, doo-doo-doo. Oh, I want something just like this. Doo-doo-doo, doo-doo-doo. Doo-doo-doo, doo-doo. Doo-doo-doo, doo-doo-doo',
      author: '- Chris Martin'     
  },
  {
    quote: 'All I wanna do is–, and a–. And take your money. All I wanna do is–, and a–. And take your money. All I wanna do is–, and a–. And take your money. All I wanna do is–, and a–. And take your money',
    author: '- M.I.A'
  }
];


function newQuote(){
   //generate random index within scope of quotes array
  var newIndex = Math.floor(Math.random()*(quotes.length));

  //Identify parts of text
var currentQuote = quotes[newIndex].quote;
var currentAuthor = quotes[newIndex].author;

  //Display quote
  document.getElementById('text').innerHTML = currentQuote;
  
    //Display author
  document.getElementById('author').innerHTML = currentAuthor;  
  
  // Append tweet url
  var tweet = new URL("https://twitter.com/intent/");
  

  //update href property
 document.getElementById("tweet-quote").href = tweet + "tweet?text=" + currentQuote + currentAuthor;

}
//Run code after page finnishes loading
window.onload = function() {
     newQuote();
};

              
            
!
999px

Console