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="everything">
    <h1>COD:Modern Warfare Quotes</h1>

    <!-- quote text -->
      <p id="quote"></p>
      <p id="authorsP">-<span id="author"></span></p>

    <!-- quote button -->
    <button id="quoteGen" class="buttColor">New Quote</button>
    <!-- tweet button -->
    <button id="tweetButton" class="buttColor fa fa-twitter"></button>

  <h5><a href="https://www.freecodecamp.com/thodorisanta" target="blank">by Thodoris</a></h5>
              body {
  margin: 5% 30% 10% 30%;
  transition: background 2s;

h1 {
  text-align: center;
  font-family: "Times New Roman", Times, serif;

p {
  font-family: "Times New Roman", Times, serif;
  transition: color 2s;

button {
  padding: 12px 20px;
  color: white;
  border: none;
  border-radius: 5px;
  transition: background 2s;

button:hover {
  box-shadow: 0px 0px 10px 3px #888888;

h5 {
  text-align: center;
  font-family: "Brush Script MT", cursive;
  font-size: 24px;

a {
  color: white;

hr {
  border: 0;
  height: 1px;
  background-image: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0));

#authorsP {
  font-family: "Lucida Bright", Georgia, serif;
  font-weight: 500;
  font-size: 17px;

#quote {
  font-size: 20px;

#everything {
  padding: 24px 24px 100px 44px;
  background-color: white;
  position: relative;
  border-radius: 9px;
  box-shadow: 0px 3px 0px 0px #222121, inset -1px -3px 10px 1px #515151;
  width: 500px;
  height: 400px;
  margin: 10% auto;

#quoteGen {
  position: absolute;
  bottom: 20px;
  right: 20px;

#tweetButton {
  position: absolute;
  bottom: 20px;
  left: 20px;
  font-size: 20px
              $(document).ready(function() {

  // Quote Array.
  var quotes = ["Never in the field of human conflict was so much owed by so many to so few.",
    "Success is not final, failure is not fatal: it is the courage to continue that counts.",
    "In war there is no prize for the runner-up.",
    "Ours is a world of nuclear giants and ethical infants. We know more about war than we know about peace, more about killing than we know about living.",
    "The soldier above all others prays for peace, for it is the soldier who must suffer and bear the deepest wounds and scars of war."

  // Authors array.
  var authors = ["Winston Churchill", "Winston Churchill", "General Omar Bradley", "General Omar Bradley", "General Douglas MacArthur"];

  //Color Array.
  var colors = ['BlueViolet', 'BurlyWood', 'Brown', 'Chartreuse', 'Chocolate', 'CornflowerBlue', 'DarkGoldenRod ', 'DarkKhaki ', 'DarkSalmon', 'DeepPink', 'Gold', 'FireBrick'];

  // Random number(for both Quote and Author).
  function getRandom() {
    return Math.floor(Math.random() * quotes.length);

  // Random Color.
  function getColor() {
    return Math.floor(Math.random() * colors.length);

  var firstRandom = getRandom();
  // Puts a random quote on page load.
  // Puts a random author on page load(according to Quote).

  var pageloadColor = colors[getColor()];
  // Puts a random color on page load.
  $("body,.buttColor").css("background", pageloadColor);
  // Puts a random (quote)text color on page load.
  $("p").css("color", pageloadColor);

  // On New Quote button click.
  $('#quoteGen').click(function() {
    var newRandom = getRandom();
    var colorKeeper = colors[getColor()];
    // FadeOut the quote and author
    $('#quote').fadeTo(500, 0).fadeTo(1000, 1);
    $("#authorsP").fadeTo(500, 0).fadeTo(1000, 1);
    setTimeout(function() {
      // Change text when they are invisible
      $('#quote').text(quotes[newRandom]); //changes quote.
      $('#author').text(authors[newRandom]); //changes author.
    }, 500);
    $("body,.buttColor").css("background", colorKeeper); //changes background and buttons colors.
    $("p").css("color", colorKeeper); //changes quote texts color.

  //on tweet button click.
  $('#tweetButton').click(function() {
    var textToTweet = $("#quote").text() + "-" + $("#author").text(); //what text to tweet.
    //twitter doesnt allow tweets with more than 140 characters.
    if (textToTweet.length > 140) {
      alert('Tweet should be less than 140 Chars');
    } else {
      var twtLink = 'https://twitter.com/home?status=' + encodeURIComponent(textToTweet); //tweet quote.    
      window.open(twtLink, '_blank'); //open twitter on a new window.
🕑 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 ..................