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

              
                <main>
  <div class="grid-container fluid">
    <div class="grid-x grid-margin-x">
      <div class="cell flex-container align-center align-middle">
        <div id="quote-box" class="card">
          <div class="card-image slow">
            <img id="image">
            <h3 id="author"></h3>
          </div>
          <div class="card-section">
            <h5 id="text"></h5>
            <small>
              <span id="episode"></span>
            </small>
          </div>
          <div class="card-actions">
            <button id="new-quote">new quote</button>
            <div class="icons">
              <a id="share-quote" href="#" target="_blank" rel="noopener noreferrer">
                <i class="fab fa-facebook-square fa-lg"></i>
              </a>
              <a id="tweet-quote" href="#" target="_blank" rel="noopener noreferrer">
                <i class="fab fa-twitter fa-lg"></i>
              </a>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</main>
<footer>
  <a href="https://github.com/b0mh0lt" target="_blank" rel="noopener noreferrer"><i class="fab fa-github-alt fa-lg"></i> M. Bomholt</a>
</footer>
<div id="preload">
  <img src="https://b0mh0lt.github.io/freeCodeCamp/legacy_front_end_development/random_quote_machine/img/711_clerk.jpg" alt="7¹¹ Clerk" width="1" height="1">
  <img src="https://b0mh0lt.github.io/freeCodeCamp/legacy_front_end_development/random_quote_machine/img/bender(1).jpg" alt="Bender" width="1" height="1">
  <img src="https://b0mh0lt.github.io/freeCodeCamp/legacy_front_end_development/random_quote_machine/img/bender(2).jpg" alt="Bender" width="1" height="1">
  <img src="https://b0mh0lt.github.io/freeCodeCamp/legacy_front_end_development/random_quote_machine/img/bender(3).jpg" alt="Bender" width="1" height="1">
  <img src="https://b0mh0lt.github.io/freeCodeCamp/legacy_front_end_development/random_quote_machine/img/bender(4).jpg" alt="Bender" width="1" height="1">
  <img src="https://b0mh0lt.github.io/freeCodeCamp/legacy_front_end_development/random_quote_machine/img/bender(5).jpg" alt="Bender" width="1" height="1">
  <img src="https://b0mh0lt.github.io/freeCodeCamp/legacy_front_end_development/random_quote_machine/img/hermes_conrad.jpg" alt="Hermes Conrad" width="1" height="1">
  <img src="https://b0mh0lt.github.io/freeCodeCamp/legacy_front_end_development/random_quote_machine/img/hubert_j_farnsworth(1).jpg" alt="Hubert J. Farnsworth" width="1" height="1">
  <img src="https://b0mh0lt.github.io/freeCodeCamp/legacy_front_end_development/random_quote_machine/img/hubert_j_farnsworth(2).jpg" alt="Hubert J. Farnsworth" width="1" height="1">
  <img src="https://b0mh0lt.github.io/freeCodeCamp/legacy_front_end_development/random_quote_machine/img/hubert_j_farnsworth(3).jpg" alt="Hubert J. Farnsworth" width="1" height="1">
  <img src="https://b0mh0lt.github.io/freeCodeCamp/legacy_front_end_development/random_quote_machine/img/john_a_zoidberg.jpg" alt="John A. Zoidberg" width="1" height="1">
  <img src="https://b0mh0lt.github.io/freeCodeCamp/legacy_front_end_development/random_quote_machine/img/lrrr.jpg" alt="Lrrr" width="1" height="1">
  <img src="https://b0mh0lt.github.io/freeCodeCamp/legacy_front_end_development/random_quote_machine/img/phillip_j_fry(1).jpg" alt="Phillip J. Fry" width="1" height="1">
  <img src="https://b0mh0lt.github.io/freeCodeCamp/legacy_front_end_development/random_quote_machine/img/phillip_j_fry(2).jpg" alt="Phillip J. Fry" width="1" height="1">
  <img src="https://b0mh0lt.github.io/freeCodeCamp/legacy_front_end_development/random_quote_machine/img/phillip_j_fry(3).jpg" alt="Phillip J. Fry" width="1" height="1">
  <img src="https://b0mh0lt.github.io/freeCodeCamp/legacy_front_end_development/random_quote_machine/img/phillip_j_fry(4).jpg" alt="Phillip J. Fry" width="1" height="1">
  <img src="https://b0mh0lt.github.io/freeCodeCamp/legacy_front_end_development/random_quote_machine/img/phillip_j_fry(5).jpg" alt="Phillip J. Fry" width="1" height="1">
  <img src="https://b0mh0lt.github.io/freeCodeCamp/legacy_front_end_development/random_quote_machine/img/turanga_leela(1).jpg" alt="Turanga Leela" width="1" height="1">
  <img src="https://b0mh0lt.github.io/freeCodeCamp/legacy_front_end_development/random_quote_machine/img/turanga_leela(2).jpg" alt="Turanga Leela" width="1" height="1">
  <img src="https://b0mh0lt.github.io/freeCodeCamp/legacy_front_end_development/random_quote_machine/img/turanga_leela(3).jpg" alt="Turanga Leela" width="1" height="1">
  <img src="https://b0mh0lt.github.io/freeCodeCamp/legacy_front_end_development/random_quote_machine/img/zapp_brannigan(1).jpg" alt="Zapp Brannigan" width="1" height="1">
  <img src="https://b0mh0lt.github.io/freeCodeCamp/legacy_front_end_development/random_quote_machine/img/zapp_brannigan(2).jpg" alt="Zapp Brannigan" width="1" height="1">
  <img src="https://b0mh0lt.github.io/freeCodeCamp/legacy_front_end_development/random_quote_machine/img/zapp_brannigan(3).jpg" alt="Zapp Brannigan" width="1" height="1">
</div>

              
            
!

CSS

              
                #preload
  display: none

html, body
  background-color: #3ba6c7
  height: 100%
  
body
  display: flex
  flex-direction: column
  height: 100vh
  
main
  flex: 1 0 auto
  
a:focus, a:hover, a:visited
  text-decoration: none

.cell
  min-height: 90vh
  
.card
  border: 0
  border-radius: 2px
  box-shadow: 0 4px 5px 0 rgba(0,0,0,0.14), 0 1px 10px 0 rgba(0,0,0,0.12), 0 2px 4px -1px rgba(0,0,0,0.20)
  font-family: "Open Sans", sans-serif
  margin: 2rem 0
  max-width: 480px
  
  .card-image
    position: relative
    
    h3
      bottom: 0
      color: #fff
      margin: 0
      padding: 1rem
      position: absolute
      text-shadow: 0 2px 4px rgba(0, 0, 0, 1)
      text-transform: uppercase
      
  .card-section
    min-height: 150px
    position: relative
    
    #text
      color: #212121
      
    #episode
      color: #9e9e9e
      bottom: 0
      right: 0
      padding: 1rem
      position: absolute
         
  .card-actions
    border-top: 1px solid rgba(238, 238, 238, 1)
    padding: 1rem
    line-height: 1.25
    
    #new-quote
      border: none
      color: #ec407a
      font-family: "Roboto", sans-serif
      font-size: .875rem
      font-weight: 500
      outline: none
      text-transform: uppercase
      cursor: pointer
      
    .icons
      float: right
      
      #share-quote
        color: #9e9e9e
        margin-right: 0.5rem
        &:hover
          color: #ec407a
        
      #tweet-quote
        color: #9e9e9e
        margin-left: 0.5rem
        &:hover
          color: #ec407a
        
footer
  background-color: #3479a5
  font-family: "Roboto", sans-serif
  font-weight: 500
  flex-shrink: 0
  height: 42px
  width: 100%
  text-align: center
  
  a
    color: #ccdee8
    font-size: .875rem
    line-height: 42px
    position: relative
    top: 2px
    &:focus,&:hover, &:visited
      color: #ccdee8
    
    svg
      margin-right: .3125rem
      vertical-align: text-bottom!important
              
            
!

JS

              
                const projectName = 'random-quote-machine';
localStorage.setItem('example_project', 'Random Quote Machine');

$(document).ready(function(){
  var quotes = [];
  var i = 0;
  var j;
  $.getJSON('https://b0mh0lt.github.io/freeCodeCamp/legacy_front_end_development/random_quote_machine/quotes.json', function(data){
    quotes = data;
    newQuote();
  });
  $('#new-quote').on('click', function(){
    newQuote();
  });
  function newQuote(){
    i = Math.floor(Math.random()*quotes.length);
    if(i === j){
      while(i === j){
        i = Math.floor(Math.random()*quotes.length);
      }
    }
    j = i;
    getQuote(i);
  }
  function getQuote(){
    MotionUI.animateIn('.card-image', 'fade-in');
    $('#image').attr('src', 'https://b0mh0lt.github.io/freeCodeCamp/legacy_front_end_development/random_quote_machine/' + quotes[i].image);
    $('#image').attr('alt', quotes[i].author);
    $('#author').html(quotes[i].author);
    $('#text').html(quotes[i].text);
    $('#episode').html(quotes[i].episode);
    $('#share-quote').attr('href', 'https://www.facebook.com/sharer/sharer.php?u=https://codepen.io/b0mh0lt/full/beeRYb');
    $('#tweet-quote').attr('href', 'https://twitter.com/intent/tweet?text=' + '\"' + quotes[i].text + '\" ―' + quotes[i].author + '&url=https://codepen.io/b0mh0lt/full/beeRYb');
  }
});

              
            
!
999px

Console