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.

+ 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 lang="en">
 <meta charset="UTF-8">
<script src="https://use.fontawesome.com/59b5333aa0.js"></script>
<link rel="stylesheet"
  <h1>Random Quote Machine</h1>
<div class = "container">
  <div class = "row">
  <div class = "quote-box">
    <p id = "quote-text">
  <p id  ="quote-author"> --
    <span id="author"></span></p>
  <div class = "text-center">
      <a href ="#"class = "btn btn-lg btn-primary" id="tweet-quote" title ="Tweet this quote!" target="_blank"><i class ="fa fa-twitter fa-con"></i></a>
    <button class = "buttons btn-lg btn-primary" id = "new-quotes">New Quotes</button>

              body {
  background-color: #247291;
h1 {
  margin-top: 50px;
  text-align : center;
  font-weight : bold;
  font-size : 60px;
  color: white;
  text-shadow: 3px 3px 5px #000;
p {
  text-align :center;
  font-family: Tangerine, serif;
  font-size : 50px;
.fa-con {
  color : white;
#tweet-quote {
#new-quotes {
  margin: 20px;
i {
  margin-right: 0.4em;
.fa fa-quote-left {
  float: left;
.quote-box {
  margin: 40px auto auto auto;
  text-align: center;
  padding: 20px;
#quote-author {
              $(document).ready(function() {
  var author;
  var quote;
  // This variable are declare globally so as not to return undefined when declare locally within the function.
  function generateQuote() {
      url: "https://cors-anywhere.herokuapp.com/https://api.forismatic.com/api/1.0/?",
      jsonp: "json",
      dataType: "json",
      //In case you encountered an error trying to access an API server. you use JSONP (JSON with Padding) is a method commonly used to bypass the cross-domain policies in web browsers. (You are not allowed to make AJAX requests to a web page perceived to be on a different server by the browser.) JSON and JSONP behave differently on the client and the server.\\
      data: {
      method: "getQuote",
      format: "json",
      lang: "en"
      success: function(response) {
        quote = response.quoteText;
        author = response.quoteAuthor;
        if(author) {
        } else {
  $(".buttons").on("click", function(e) {
  $("#tweet-quote").on("click", function(e) {
   // Sharing your quotes on twitter.
    window.open("https://twitter.com/intent/tweet?text=" + encodeURIComponent(quote + " — " + author));

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