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

              
                <html>

<head>
  <title>Random Star Wars Quote Generator</title>
  <link href='https://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'>
</head>

<body>
  <section class="container-fluid">
    <h1>Random Star Wars Quote
          Generator</h1>
    <div class="jumbotron">
      <p id="quote">A long time ago in a galaxy far,far away...</p>
      <p id="author"></p>
      <a href="#"><button type="button" class="btn" id="quote-btn">New
        Quote</button></a>
      <a href="#"><button type="button" class="btn" id="tweet-btn">Tweet It!</button></a>
    </div>
  </section>
</body>

</html>
              
            
!

CSS

              
                body {
  background-image: url('https://images2.alphacoders.com/264/26492.jpg');
  background-repeat: no-repeat;
  background-size: cover;
}

h1 {
  text-align: center;
  margin-top: 50px;
  margin-bottom: 50px;
  font-size: 80px;
  font-family: 'Droid Sans', sans-serif;
}

.jumbotron {
  position: relative;
  height: 300px;
  width: 750px;
  margin: 0 auto;
  background-color: #ffdf80;
  opacity: 0.6;
  filter: alpha(opacity=60);
}

#quote {
  margin-bottom: 20px;
  font-size: 30px;
  margin: 0 auto;
}

#author {
  text-align: right;
  margin-right: 50px;
}

.btn {
  position: relative;
  bottom: 0px;
  font-size: 26px;
  margin-left: 20px;
  font-family: 'Droid Sans', sans-serif;
}
              
            
!

JS

              
                var quotes = [{
  quote: "Fear is the path to the dark side. Fear leads to anger. Anger leads to hate. Hate leads to suffering.",
  name: "-Yoda"
}, {
  quote: "The ability to speak does not make you intelligent.",
  name: "-Qui-Gon Jinn"
}, {
  quote: "Remember...the Force will be with you always.",
  name: "-Obi-Wan Kenobi"
}, {
  quote: "The Force is strong with this one.",
  name: "-Darth Vader"
}, {
  quote: "Sometimes we must let go of our pride and do what is requested of us.",
  name: "-Padme Amidala"
}, {
  quote: "Do or do not. There is no try.",
  name: "-Yoda"
}, {
  quote: "I am a Jedi, like my father before me.",
  name: "-Luke Skywalker"
}, {
  quote: "You have your moments. Not many of them, but you have them.",
  name: "-Princess Leia"
}, {
  quote: "If you want to be successful in a particular field, perseverance is one of the key qualities.",
  name: "-George Lucas"
}, {
  quote: "Always pass on what you have learned.",
  name: "-Yoda"
}, {
  quote: "Your focus determines your reality.",
  name: "-Qui-Gon Jinn"
}, {
  quote: "You can't stop change any more than you can stop the suns from setting.",
  name: "-Shmi Skywalker"
}, {
  quote: "Someday I will be the most powerful Jedi ever.",
  name: "-Anakin Skywalker"
}, {
  quote: "I sense great fear in you, Skywalker. You have hate. You have anger. But you don't use them.",
  name: "-Count Dooku"
}];

$(document).ready(function() {

  $('#quote-btn').click(function() {
    var quotesLength = quotes.length;
    var rand = Math.floor(Math.random() * quotesLength);
    $("#quote").text(quotes[rand].quote);
    $("#author").text(quotes[rand].name);
  });

  $('#tweet-btn').click(function() {
    window.open('https://twitter.com/intent/tweet?text=' + $('#quote').text() + " " + $('#author').text());
  });

});
              
            
!
999px

Console