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>
  <link href="https://fonts.googleapis.com/css?   family=Courgette" rel="stylesheet">
</head>
<body>
      <h1>Random Quotes</h1>
      <div id="main_wrapper">
        <h2 id="quote"></h2>
        <div id="btn_box">
          <button id="tweetBtn"                   class="btn">Tweet</button>
          <button id="newQuoteBtn" 
                  class="btn">New Quote</button>
        </div>
      </div>
  
</body>
            
          
!
            
              *{
  margin:0;
  padding: 0;
}

body{
  text-align: center;
  margin-top: 100px;
  transition:background-color 2s ease;
}

h1{
  font-family: 'Courgette',cursive;
}

#main_wrapper{
  margin: 65px auto;
  height: 200px;
  width: 500px;
  padding-top: 50px;
  background: white;
  border-radius: 5px;
  position: relative;
}

#btn_box{
  position: absolute;
  bottom: 0;
  margin:70px 50px;
  width: 80%;
}

#newQuoteBtn{
  float: right;
  margin-right: 10px;
}

#tweetBtn{
  float: left;
  margin-left: 10px;
}

button:focus {
  outline:0 !important;
}

.btn{
  cursor: pointer;
  height: 40px;
  border-radius: 5px;
  color: white;
  padding: 10px;
  transition:background-color 2s ease; 
}
            
          
!
            
              const quotesArr = [
            '“The Way To Get Started Is To Quit Talking And Begin Doing.” -Walt Disney',
            '“The Pessimist Sees Difficulty In Every Opportunity. The Optimist Sees Opportunity In Every Difficulty.” -Winston Churchill',
            '“Don’t Let Yesterday Take Up Too Much Of Today.” -Will Rogers',
            '“You Learn More From Failure Than From Success. Don’t Let It Stop You. Failure Builds Character.”- Unknown',
            '“It’s Not Whether You Get Knocked Down, It’s Whether You Get Up.” – Inspirational Quote By Vince Lombardi',
            '“If You Are Working On Something That You Really Care About, You Don’t Have To Be Pushed. The Vision Pulls You.”- Steve Jobs',
            '“People Who Are Crazy Enough To Think They Can Change The World, Are The Ones Who Do.”- Rob Siltanen',
            '“Failure Will Never Overtake Me If My Determination To Succeed Is Strong Enough.”- Og Mandino',
            '“Entrepreneurs Are Great At Dealing With Uncertainty And Also Very Good At Minimizing Risk. That’s The Classic Entrepreneur.”- Mohnish Pabrai',
            '“We May Encounter Many Defeats But We Must Not Be Defeated.”- Maya Angelou',
            '“Knowing Is Not Enough; We Must Apply. Wishing Is Not Enough; We Must Do.”- Johann Wolfgang Von Goethe',
            '“Imagine Your Life Is Perfect In Every Respect; What Would It Look Like?”- Brian Tracy',
            '“We Generate Fears While We Sit. We Overcome Them By Action.”- Dr. Henry Link',
            '“Whether You Think You Can Or Think You Can’t, You’re Right.”- Henry Ford',
            '“Security Is Mostly A Superstition. Life Is Either A Daring Adventure Or Nothing.”- Helen Keller',
            '“The Man Who Has Confidence In Himself Gains The Confidence Of Others.”- Hasidic Proverb',
            '“The Only Limit To Our Realization Of Tomorrow Will Be Our Doubts Of Today.”- Franklin D. Roosevelt',
            ' “Creativity Is Intelligence Having Fun.”- Albert Einstein',
            ' “What You Lack In Talent Can Be Made Up With Desire, Hustle And Giving 110% All The Time.”- Don Zimmer',
            '“Do What You Can With All You Have, Wherever You Are.”- Theodore Roosevelt',
            '“Develop An ‘Attitude Of Gratitude’. Say Thank You To Everyone You Meet For Everything They Do For You.”- Brian Tracy',
            '“You Are Never Too Old To Set Another Goal Or To Dream A New Dream.”- C.S. Lewis',
            '“To See What Is Right And Not Do It Is A Lack Of Courage.”- Confucious',
            '“Reading Is To The Mind, As Exercise Is To The Body.”- Brian Tracy',
            '“Fake It Until You Make It! Act As If You Had All The Confidence You Require Until It Becomes Your Reality.”- Brian Tracy',
            '“The Future Belongs To The Competent. Get Good, Get Better, Be The Best!”- Success Quote By Brian Tracy',
            '“For Every Reason It’s Not Possible, There Are Hundreds Of People Who Have Faced The Same Circumstances And Succeeded.” – Jack Canfield',
            '“Things Work Out Best For Those Who Make The Best Of How Things Work Out.” – Positive Quote By John Wooden',
            '“A Room Without Books Is Like A Body Without A Soul.” – Marcus Tullius Cicero',
            ' “I Think Goals Should Never Be Easy, They Should Force You To Work, Even If They Are Uncomfortable At The Time.” – Michael Phelps',
            '“One Of The Lessons That I Grew Up With Was To Always Stay True To Yourself And Never Let What Somebody Else Says Distract You From Your Goals.” Michelle Obama',
            '“Today’s Accomplishments Were Yesterday’s Impossibilities.” – Robert H. Schuller',
            '“The Only Way To Do Great Work Is To Love What You Do. If You Haven’t Found It Yet, Keep Looking. Don’t Settle.” – Steve Jobs',
            '“You Don’t Have To Be Great To Start, But You Have To Start To Be Great.” – Zig Ziglar',
            '“A Clear Vision, Backed By Definite Plans, Gives You A Tremendous Feeling Of Confidence And Personal Power.” – Brian Tracy',
            '“There Are No Limits To What You Can Accomplish, Except The Limits You Place On Your Own Thinking.” – Brian Tracy'
        ];
            
        const colorArr = ["#f45042", "#f4dc41", "#6df441", "#41f4a3", "#41dcf4", "#4170f4", "#7f41f4", "#d041f4", "#f441ca", "#f4417c"];
        
        let index = 0;
        let colorInd = 0;
        
        $(document).ready(function(){
            
            $("#quote").text(quotesArr[index]);
            $("body,.btn").css("background",colorArr[colorInd]);
            $("#quote").css("color",colorArr[colorInd]);
            
            $("#newQuoteBtn").click(function(){
                index = index === quotesArr.length-1?0:index+1;
                colorInd = colorInd === colorArr.length-1?0:colorInd+1;
               $("body,.btn").css("background",colorArr[colorInd]);
               $("#quote").fadeOut("slow",function(){
                   $(this).text(quotesArr[index]);
                   $(this).css("color",colorArr[colorInd]);
               }).fadeIn("slow");
            
            });
            
            $(".btn").hover(function(){
                $(this).animate({opacity:"0.65"});
            },function(){
                $(this).animate({opacity:"1.0"});
            });
            
            $("#tweetBtn").click(function(){
                window.open("http://www.twitter.com/intent/tweet?hashtags=quotes&related=freecodecamp&text=" + 
                           quotesArr[index]);
            });
            
            
        });
            
          
!
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