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.

            
              <blockquote class="random-quote">
  <p id="new-quote"></p>
   <cite id="author"></cite>
</blockquote>
            
          
!
            
              /* http://meyerweb.com/eric/tools/css/reset/ 
   v2.0 | 20110126
   License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
  display: block;
}
body {
  line-height: 1;
}
ol, ul {
  list-style: none;
}
blockquote, q {
  quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
  content: '';
  content: none;
}
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/*************************************************************************************************************************/

html, body {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #23074d;  /* fallback for old browsers */
  background: -webkit-linear-gradient(to right, #cc5333, #23074d);  /* Chrome 10-25, Safari 5.1-6 */
  background: linear-gradient(to right, #cc5333, #23074d); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */

}

.random-quote {
  -webkit-filter: drop-shadow(-1px -1px 2px rgba(0, 0, 0, 0.1)) drop-shadow(1px 2px 2px rgba(0, 0, 0, 0.15));
          filter: drop-shadow(-1px -1px 2px rgba(0, 0, 0, 0.1)) drop-shadow(1px 2px 2px rgba(0, 0, 0, 0.15));
  margin: 1rem;
  margin-bottom: 40px;
  position: relative;
  font-family: 'Montserrat', sans-serif;
  font-size: 1.2rem;
  font-weight: 400;
  background: #C95233; 
  color: white;
  max-width: 40vw;
  line-height: 1.4;
}

#new-quote {
  padding: 1.5rem 2rem;
  cursor: pointer;
  min-width: 10vw;
  display: flex;
}

p#new-quote {
  justify-content: center;
}

.random-quote::before {
  border: 12.5px solid transparent;
  border-top: 12.5px solid #C95233;
  border-bottom: 0;
  height: 0;
  width: 0;
  border-top-width: 25px;
  content: '';
  display: block;
  position: absolute;
  left: 3rem;
  bottom: -25px;
  -webkit-transform-origin: center;
          transform-origin: center;
  -webkit-transform: rotate(90deg) skew(-25deg) translateY(16.6666666667px);
          transform: rotate(90deg) skew(-25deg) translateY(16.6666666667px);
}

.random-quote cite {
  position: absolute;
  bottom: -2rem;
  left: 4.5rem;
  font-size: 1rem;
  font-style: normal;
  font-weight: 300;
  letter-spacing: 0.5px;
  color: white;
}

            
          
!
            
              /* 
    Random Quote Generator - Pulls a random from the array of quotes
*/

let quoteArray = [
    {
        content: "Let's get crazy!",
        author: "Bob Ross"
    },
    {
        content: "Wash the brush, just beats the devil out of it!",
        author: "Bob Ross"
    },
    {
        content: "Nah.",
        author: "Rosa Parks"
    },
    {
        content: "That is the key to navigating this life — don't take it too seriously. That's when the party begins.",
        author: "Ru Paul"
    },
    {
        content: "May the forces of evil become confused on the way to your house",
        author: "George Carlin"
    },
    {
        content: "Just cause you got the monkey off your back doesn't mean the circus has left town.",
        author: "George Carlin"
    },
    {
        content: "Life is 10% what happens to you and 90% how you react to it.",
        author: "Charles R. Swindoll"
    },
    {
        content: "Cynicism masquerades as wisdom, but it is the furthest thing from it. Because cynics don't learn anything. Because cynicism is a self-imposed blindness: a rejection of the world because we are afraid it will hurt us or disappoint us. Cynics always say 'no.' But saying 'yes' begins things. Saying 'yes' is how things grow.",
        author: "Stephen Colbert"
    },
    {
        content: "You can't really be passionately moderate. It's like wearing an 'Extra Medium' - it doesn't exist.",
        author: "Stephen Colbert"
    },
    {
        content: "There's an old saying about those who forget history. I don't remember it, but it's good.",
        author: "Stephen Colbert"
    },
    {
        content: "The Internet is just a world passing around notes in a classroom.",
        author: "Jon Stewart"
    },
    {
        content: "Confidence is 10% hard work and 90% delusion.",
        author: "Tina Fey"
    },
    {
        content: "The evil that is in the world almost always comes of ignorance, and good intentions may do as much harm as malevolence if they lack understanding.",
        author: "Albert Camus"
    },
    {
        content: "Blessed are the hearts that can bend; they shall never be broken.",
        author: "Albert Camus"
    }

];

//Setup html elements
let button = document.getElementById('new-quote'),
    quote = document.getElementById('new-quote'),
    author = document.getElementById('author');

//Generate a Random Quote
window.onload = randomQuote;
button.addEventListener('click', randomQuote);

//Random quote function
function randomQuote (){
    //Get a random number to pick a random quote object
    const random = Math.floor(Math.random() * quoteArray.length);
    //Get the quote content
    quote.innerHTML = quoteArray[random].content;
    //Get the quote author
    author.innerHTML = '&mdash; ' + quoteArray[random].author;
}
            
          
!
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