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

              
                <div class="quotes">
  <article class="container">
    <h1 id="quoteArea"></h1>
  </article>
</div>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css2?family=Pinyon+Script&display=swap');

#quoteArea {
  opacity: 1;
  transition: opacity 0.75s, transform 0.75s;  
  
  &.fadeout {
    opacity: 0;
    transform: translateY(1.25rem);
  }
}

.quotes {
  padding: 4rem 1rem;
}

.container {
  display: flex;
  justify-content: center;
  margin-left: auto;
  margin-right: auto;
  width: 90%;
  max-width: 600px;
  height: 100%;
  text-align: center;
  font-family: sans-serif;
  
  h1 {
    font: {
      family: 'Pinyon Script', cursive;
      size: 3rem;
      weight: 300;
    }
    color: #2e2e2e;
    text-shadow: 0px 0px 8px rgba(50, 50, 50, 0.25);
  }
}
              
            
!

JS

              
                var quoteArea = document.querySelector('#quoteArea');
var slideDuration = 10000;

// Store the quotes in this array
var quotes = ['The way to get started is to quit talking and begin doing', 
              'If life were predictable it would cease to be life, and be without flavor', 
              'Life is what happens when you\'re busy making other plans', 
              'When you reach the end of your rope, tie a knot in it and hang on',
             'Never let the fear of striking out keep you from playing the game',
             'Life is either a daring adventure or nothing at all',
             'Love the life you live. Live the life you love',
             'If you really look closely, most overnight successes took a long time',
             'I failed my way to success',
             'Success is walking from failure to failure with no loss of enthusiasm'];

// // Get a random number, 
function getRandomInt(max) {
  // Get a random integer between 0 and the array length
  return Math.floor(Math.random() * Math.floor(max));
}

function changeQuotes() {
  // Get the length of the quotes array
  var quotesLength = quotes.length;
  // Use that quote array length as an arg for generating a random number
  var randomNum = getRandomInt(quotesLength);
  // Select a quote from the array using that random number
  var randomQuote = quotes[randomNum];
  
  quoteArea.classList.add('fadeout');
  
    setTimeout(function () {
    quoteArea.innerHTML = randomQuote;
    quoteArea.classList.remove("fadeout");
  }, 1250);
  
  
  setTimeout(changeQuotes, slideDuration);
}

changeQuotes();
              
            
!
999px

Console