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 includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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

              
                <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">

<body>
  <h1 class="text-center">Random Quote Machine</h1>
  <div class="box">
    <div class="quote text-center">
    </div>
    <div class="name text-right">
    </div>
    <div>
      <a href="https://twitter.com/intent/tweet?hashtags=quotes&related=freecodecamp&text=" alt="twitter" target="_blank"><button class="btn btn-primary left"><i class ="fa fa-twitter"></i></button></a>
      <button class="btn btn-primary right">Next Quote</button>
    </div>
  </div>
</body>
              
            
!

CSS

              
                body {
  background-color: #A4DDFF;
}

h1 {
  margin-top: 30px;
  margin-bottom: 50px;
}

.box {
  width: 550px;
  border: 1px solid black;
  margin: auto;
  padding: 20px;
  background-color: white;
}

.quote {
  font-size: 25px;
}

.name {
  margin-top: 10px;
  margin-right: 15px;
}

.left {
  margin: 30px 20px 20px 60px;
  cursor: pointer;
}

.right {
  float: right;
  margin: 30px 60px 20px 20px;
  cursor: pointer;
}
              
            
!

JS

              
                 $(document).ready(function() {

var a = [{
    quote: "Don't cry because it's over, smile because it happened.",
    name: "~Dr. Seuss"
  }, {
    quote: "I'm selfish, impatient and a little insecure. I make mistakes, I am out of control and at times hard to handle. But if you can't handle me at my worst, then you sure as hell don't deserve me at my best.",
    name: "~Marilyn Monroe"
  }, {
    quote: "Be yourself; everyone else is already taken.",
    name: "~Oscar Wilde"
  }, {
    quote: "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.",
    name: "~Albert Einstein"
  }, {
    quote: "Be who you are and say what you feel, because those who mind don't matter, and those who matter don't mind.",
    name: "~Bernard M. Baruch"
  }, {
    quote: "So many books, so little time.",
    name: "~Frank Zappa"
  }, {
    quote: "A room without books is like a body without a soul.",
    name: "~Marcus Tullius Cicero"
  }, {
    quote: "You know you're in love when you can't fall asleep because reality is finally better than your dreams.",
    name: "~Dr. Seuss"
  }, {
    quote: "You only live once, but if you do it right, once is enough.",
    name: "~Mae West"
  }, {
    quote: "Be the change that you wish to see in the world.",
    name: "~Mahatma Gandhi"
  }, {
    quote: "In three words I can sum up everything I've learned about life: it goes on.",
    name: "~Robert Frost"
  }, {
    quote: "If you want to know what a man's like, take a good look at how he treats his inferiors, not his equals.",
    name: "~J.K. Rowling, Harry Potter and the Goblet of Fire"
  }, {
    quote: "Friendship ... is born at the moment when one man says to another \"What! You too? I thought that no one but myself . . .",
    name: "~C.S. Lewis, The Four Loves"
  }, {
    quote: "No one can make you feel inferior without your consent.",
    name: "~Eleanor Roosevelt, This is My Story"
  }, {
    quote: "If you tell the truth, you don't have to remember anything.",
    name: "~Mark Twain"
  }, {
    quote: "A friend is someone who knows all about you and still loves you.",
    name: "~Elbert Hubbard"
  }, {
    quote: "I've learned that people will forget what you said, people will forget what you did, but people will never forget how you made them feel.",
    name: "~Maya Angelou"
  }, {
    quote: "Always forgive your enemies; nothing annoys them so much.",
    name: "~Oscar Wilde"
  }]

var r = Math.floor(Math.random() * a.length); $(".quote").html(a[r].quote); $(".name").html(a[r].name);
    
  $(".right").click(function(){
    var r = Math.floor(Math.random() * a.length);
    $(".quote").html(a[r].quote);
  $(".name").html(a[r].name);
  })  
});

              
            
!
999px

Console