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.

            
              <head>
  <title>My Quote Machine</title>
</head>
<body>
  <div id="background" class="container-fluid">
    <div class="row">
      <h1 id="title" class="text-center text-uppercase">Random Quote Machine</h1>
    </div>
    <div class="row">
      <div id="text" class="text-center">
        Click the button to get a random quote about success.<br /> Tweet it if you find it inspiring.
      </div>
    </div>
    <hr class="col-xs-12 intro-divider">
    <div class="row">
      <div id="quote" class="col-xs-8 col-xs-offset-2 text-center">
        Click the button to get a random quote about success.<br /> Tweet it if you find it inspiring.
      </div>
    </div>
    <hr class="col-xs-12 intro-divider">
    <div class="row">
      <div id="button1" class="text-center">
        <button id="new-quote" class="btn btn-success" role="button">Get a new quote</button>
      </div>
    </div>
    <br />
    <div class="row">
      <div id="tweet-container" class="text-center"></div>
    </div>
  </div>
</body>
            
          
!
            
              html, body {
  width: 100%;
  height: 100%;
  background: url(https://images.unsplash.com/photo-1427501482951-3da9b725be23?q=80&fm=jpg&s=f68edb15ce4565555ccf9b6395da4dff) no-repeat center center fixed; 
  opacity: 0.98;
  width: 100%;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

body, h1, h2, h3, h4, h5, h6 {
    font-family: "Lato", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

#text{
  margin-top: 25px;
  font-size: 20px;
  color: #FFF;
  text-shadow: 0px 2px 3px #444;
}

#quote{
  font-size: 27px;
  color: #F00;
  text-shadow: 0px 2px 3px #111;
}

#title{
  font-size: 40px;
  font-weight: 700;
  color: #FFF;
  text-shadow: 0px 2px 3px #444;
}

#button2{
  margin-top: 10px;
}
            
          
!
            
              var twitter_url = "https://twitter.com/intent/tweet";
var quotes = [
      "Success is nothing more than a few simple disciplines, practiced every day.",
      "Coming together is a beginning; keeping together is progress; working together is success.",
      "Success is not final, failure is not fatal: it is the courage to continue that counts.",
      "The price of success is hard work, dedication to the job at hand, and the determination that whether we win or lose, we have applied the best of ourselves to the task at hand.",
      "Don't aim for success if you want it; just do what you love and believe in, and it will come naturally.",
      "Always be yourself, express yourself, have faith in yourself, do not go out and look for a successful personality and duplicate it.",
      "Success consists of going from failure to failure without loss of enthusiasm.",
      "The starting point of all achievement is desire.",
      "Man needs his difficulties because they are necessary to enjoy success.",
      "Success is not the key to happiness. Happiness is the key to success. If you love what you are doing, you will be successful."
    ];
var number;
var quote;

$( document ).ready(function() {
    $( "#new-quote" ).click(function() {
        number = getRandom(0, 9);
        quote = quotes[number];
        $("#quote").html(quote);
	   $("#tweet-container").html("");
        twttr.widgets.createShareButton(
        	"http:\/\/codepen.io\/husamp\/pen\/YyKLze",
        	document.getElementById("tweet-container"),
        	{
            size: "large",
            //via: "\",
            text: quote
        	}
	  );
    });
});
  
var getRandom = function (min, max) {
    return Math.floor(Math.random() * (max - min + 1)) + min;
}
            
          
!
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.
Loading ..................

Console