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.

            
              <html>
  <head>
    <!--Font Library - GlacialIndifferenceRegular-->
    <link rel="stylesheet" media="screen" href="https://fontlibrary.org/face/glacial-indifference" type="text/css"/>
    
    <!--Font Awesome Twitter Icon -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
  </head>
  <body>
    <div class="container-fluid">
        
        <div class="row-fluid row1">
          <div class="col-xs-12 col-xs-offset-0 quote-area text-center">
            <h3><i class="fa fa-quote-left fa-4"></i>
              The will to win, the desire to succeed, the urge to reach your full potential... these are the keys that will unlock the door to personal excellence.
            </h3>
          </div> <!-- end quote-area-->
        </div>  <!-- end row1-->
       
        <div class="row-fluid row2">
          <div class="col-xs-5 col-xs-offset-5 quote-author pull-right">
            <h4>- Confucius</h4>
          </div> <!-- end quote-author-->
        </div> <!-- end row2-->
        
        <div class="row-fluid row3">
          <div class="col-xs-2 tweet-button pull-left">
            <a class="btn" href="https://twitter.com/intent/tweet?hashtags=quotes&related=freecodecamp&text=" target="_blank">
              <i class="fa fa-twitter fa-2x"></i>
            </a>
          </div> <!--end tweet-button-->
          <div class="col-md-3 pull-right">
            <button class="btn btn-block new-quote-button">New Quote</button>
          </div> <!--end new-quote-button-->
        </div> <!--end row3-->
      
    </div> 
  </body>
</html>
            
          
!
            
              body {
  background: rgb(11, 116, 123);
  color: rgb(11, 116, 123);
  
  font-family: 'GlacialIndifferenceRegular'; 
   font-weight: normal; 
   font-style: normal; 
}

.container-fluid {
  width: 50%;
  height: 30%;
  margin-top: 50px;
  background-color: white;
  padding: 30px;
}

.tweet-button a {
  background-color: rgb(11, 116, 123);
  margin-top: 60px;
}

.fa-twitter {
  color: white;
}

.new-quote-button {
  background-color: rgb(11, 116, 123);
  color: white;
  height: 42px;
  margin-top: 20px;
}

.btn:focus,.btn:active:focus,.btn.active:focus,
.btn.focus,.btn:active.focus,.btn.active.focus {
    color: white;
}
            
          
!
            
              $(document).ready(function(){
  
  //quotes and their authors
  var quotes = [
    {
			quote: "Start by doing what's necessary; then do what's possible; and suddenly you are doing the impossible.",
			name:"Francis of Assisi"
	    },
	    {
	    	quote:"Believe you can and you're halfway there.",
	    	name:"Theodore Roosevelt"
	    },
	    {
	    	quote:"It does not matter how slowly you go as long as you do not stop.",
	    	name:"Confucius"
	    },
	    {
	    	quote:"Our greatest weakness lies in giving up. The most certain way to succeed is always to try just one more time.",
	    	name:"Thomas A. Edison"
	    },
	    {
	    	quote:"The will to win, the desire to succeed, the urge to reach your full potential... these are the keys that will unlock the door to personal excellence.",
	    	name:"Confucius"
	    },
	    {
	    	quote:"Don't watch the clock; do what it does. Keep going.",
	    	name:"Sam Levenson"
	    },
	    {
	    	quote:"A creative man is motivated by the desire to achieve, not by the desire to beat others.",
	    	name:"Ayn Rand"
	    },
      {
	    	quote:"Expect problems and eat them for breakfast.",
	    	name:"Alfred A. Montapert"
	    },
	    {
	    	quote:"Start where you are. Use what you have. Do what you can.",
	    	name:"Arthur Ashe"
	    },
	    {
	    	quote:"Ever tried. Ever failed. No matter. Try Again. Fail again. Fail better.",
	    	name:"Samuel Beckett"
	    },
	    {
	    	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:"Always remember that you are absolutely unique. Just like everyone else.",
	    	name:"Margaret Mead"
	    },
	    {
	    	quote:"Do not take life too seriously. You will never get out of it alive.",
	    	name:"Elbert Hubbard"
	    },
	    {
	    	quote:"People who think they know everything are a great annoyance to those of us who do.",
	    	name:"Isaac Asimov"
	    },
	    {
	    	quote:"Procrastination is the art of keeping up with yesterday.",
	    	name:"Don Marquis"
	    },
	    {
	    	quote:"Get your facts first, then you can distort them as you please.",
	    	name:"Mark Twain"
	    },
	    {
	    	quote:"A day without sunshine is like, you know, night.",
	    	name:"Steve Martin"
	    },
	    {
	    	quote:"My grandmother started walking five miles a day when she was sixty. She's ninety-seven now, and we don't know where the hell she is.",
	    	name:"Ellen DeGeneres"
	    },
	    {
	    	quote:"Don't sweat the petty things and don't pet the sweaty things.",
	    	name:"George Carlin"
	    },
	    {
	    	quote:"Always do whatever's next.",
	    	name:"George Carlin"
	    },
	    {
	    	quote:"Atheism is a non-prophet organization.",
	    	name:"George Carlin"
	    },
	    {
	    	quote:"Hapiness is not something ready made. It comes from your own actions.",
	    	name:"Dalai Lama"
	    }
  ];
  
  //change background, quote and author on clicking New Quote
  $(".new-quote-button").click(function(){
  //Initialize new quote and its author
    var randomNo = Math.floor(Math.random() * quotes.length);
    var quote = quotes[randomNo].quote;
    var author = quotes[randomNo].name;
    
  //Initialize the Twitter share URL
    $baseTwitterURL = "https://twitter.com/intent/tweet?hashtags=quotes&related=freecodecamp&text=";
    $encodedQuote = encodeURIComponent(quote);
    $encodedSpace = encodeURIComponent(" - ")
    $encodedAuthor = encodeURIComponent(author);
    $twitterURL = $baseTwitterURL + '"' + $encodedQuote + '"' + $encodedSpace + $encodedAuthor;
//    $twitterUrl = $baseTwitterUrl + '"' + encodeURIComponent(quote) + '"' + encodeURIComponent(" " + author);
    
  //Initialize new random background color
    do
      {
        var x = Math.floor(Math.random() * 256);
        var y = Math.floor(Math.random() * 256);
        var z = Math.floor(Math.random() * 256);
      }
    while (x >= 200 || y >= 200 || z >= 175);               //If either of x, y, or z is >200, the rgb color tends to be of very light hue
    
    var newColor = "rgb(" + x + ", " + y + ", " + z + ")";

    //change container quote, author, tweet href and color
    $(".container-fluid").fadeOut(800, function(){ 
        $("body").css("color", newColor);
        $(".tweet-button a").css("background-color", newColor);
        $(".new-quote-button").css("background-color", newColor);
      
        $(".quote-area").html("");
        $(".quote-area").append("<h3><i class='fa fa-quote-left fa-4'></i> " + quote + "</h3>");
        $(".quote-author").html("");
        $(".quote-author").append("<h4>- " + author + "</h4>");
        $(".tweet-button a").attr("href", $twitterURL);
        $(this).fadeIn(800); 
    });   //end container fadeout
    
    //background transition using jQuery color/ui
    $("body").animate({backgroundColor: newColor}, 1000);
  
 }); //end new-quote-button click
  
});  //end document ready
            
          
!
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