123

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 class="w3-mobile">
  <div class="w3-container" style="padding: 5% 20% 0 20%">
    <h1 class="headTitle">Random Quote Generator</h1>
    <h4 class="headTitle">Click the <em>/New Quote/</em> button for a new Random Quote.<br>You can even "Tweet" your favorite Quotes to your friends too. Check out my other projects here on CodePen.io<br>If not, enjoy this Generator and thank you for stopping by.</h4>
    <div class="w3-container w3-centered">
      <button id="newQuote" class="w3-btn w3-ripple w3-xlarge w3-round-large w3-black w3-hover-green" onclick="quoGen()" style="font-family: 'Jim Nightshade', cursive">New Quote</button>
    </div>
    <div class="w3-container w3-card-4 w3-mobile" style="margin: 10% 5% 0 5%; padding: 0 5% 1% 5%; background-color: lightblue">
      <div style="text-align: center">
        <p id="quoteGenerator">Click the new quote button.</p>
      </div>
      <div id="tweet">
        <a href="https://twitter.com/intent/tweet" class="twitter-share-button" data-url="https://codepen.io/OpenProCramMaker" data-size="large" data-text="Choose a new quote" data-via="cand1233" data-hashtags="generator" data-related="freeCodeCamp,CodePen" data-show-count="false">Tweet</a>
        <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
      </div>
      
    </div>
    <footer class="w3-center" style="color: white;"><i class="fa fa-code"></i> Coded by Chris Anderson <i class="fa fa-copyright"></i> freeCodeCamp <i class="fa fa-free-code-camp"></i></footer>
  </div>
</div>

            
          
!
            
              body {
  background-color: darkblue;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='112' height='92' viewBox='0 0 112 92'%3E%3Cg fill='%24bac146' fill-opacity='0.25'%3E%3Cpath fill-rule='evenodd' d='M72 10H40L16 20H0v8h16l24-14h32l24 14h16v-8H96L72 10zm0-8H40L16 4H0v8h16l24-6h32l24 6h16V4H96L72 2zm0 84H40l-24-6H0v8h16l24 2h32l24-2h16v-8H96l-24 6zm0-8H40L16 64H0v8h16l24 10h32l24-10h16v-8H96L72 78zm0-12H40L16 56H0v4h16l24 14h32l24-14h16v-4H96L72 66zm0-16H40l-24-2H0v4h16l24 6h32l24-6h16v-4H96l-24 2zm0-16H40l-24 6H0v4h16l24-2h32l24 2h16v-4H96l-24-6zm0-16H40L16 32H0v4h16l24-10h32l24 10h16v-4H96L72 18z'/%3E%3C/g%3E%3C/svg%3E");
}
.backgroundDiv {
  
  
}
.headTitle {
  text-align: center;
}
div h1 {
  color: white;
  font-size: 43px;
  font-family: "Berkshire Swash", cursive;
}
div h4 {
  color: lightgray;
  font-size: 24px;
  font-family: "Jim Nightshade", cursive;
}
#quoteGenerator {
  font-family: "Jim Nightshade", cursive;
  font-size: 38px;
}
footer {
  font-family: 'IM Fell DW Pica SC', serif;
  font-size: 14px;
  color: white;
  padding-bottom: 5px;
}
            
          
!
            
              var quotes = [
  "'The opposite of a correct statement is a false statement. But the opposite of a profound truth may well be another profound truth.' -Niels Bohr",
  "'We accept the Love we think we deserve.' -Stephen Chbosky",
  "'Inner peace begins the moment you choose not to let another person or event to control your emotions.' -Pema Chodron",
  "'You must tell yourself 'No matter how hard it is, or how hard it gets, I'm going to make it.' -Les Brown",
  "'If it won't matter in 5 years, don't spend more than 5 minutes getting angry about it.' -blacklinesuccess.com",
  "'Think for Yourself. Trust your own Intuition. Another's mind isn't walking your journey, You are.' -Scottie Waves",
  "'The secret of change is to focus all of your energy, not on fighting the old but on building the new.' -Socrates",
  "'You'll never be as lazy as whoever named the fireplace.' -@longwall26",
  "'Why fool around with a hamburger when you have a steak at home?' -Paul Newman",
  "'I don't believe in pessimism. If something doesn't come up the way you want, forge ahead. If you think it's going to rain, it will.' -Clint Eastwood",
  "'The best and most beautiful things in the world cannot be seen or even touched -they must be felt by the heart.' -Helen Keller"
];
var quote = "Open";

function quoGen() {
  var randNum = Math.floor((Math.random() * quotes.length));
  var randQuo = quotes[randNum];  
  quote = randQuo
  document.getElementById("quoteGenerator").innerHTML = quote;
};


$("#newQuote").on("click", function(ev) {
  ev.preventDefault();
  
  $("#tweet iframe").remove();
  
  var tweet = $("<a></a>")
        .addClass("twitter-share-button")
        .attr("data-size", "large")
        .attr("href", "http://twitter.com/intent/tweet")
        .attr("data-url", "false")
        .attr("data-text", $("p:first").text())
        .attr("data-via", "cand1233")
        .attr("data-hashtags", "")
        .attr("data-related", "freeCodeCamp,CodePen")
        .attr("data-show-count", "false")
    $("#tweet").append(tweet);
    twttr.widgets.load();
});
            
          
!
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.

Console