Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


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


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.


Auto Save

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.


                <div class="container">

  <div class="socialMedia">
    <a href="" class="socialIcon" target="_blank">
      <img src="" alt="" class="icon"/>
    </a> <!-- end .socialIcon -->
    <a class="socialIcon" href="" target="_blank">
      <img src="" alt="" class="icon" />   
    </a> <!-- end .socialIcon -->
    <a href="" class="socialIcon" target="_blank">
      <img src="" alt="" class="icon" />
    </a> <!-- end .socialIcon -->
  </div> <!-- end .socialMedia -->

  <div class="quoteBubble">
    <div class="quote">If you tell the truth, you don't have to remember anything.</div>
  </div> <!-- end .quoteBubble -->
  <div class="author">Mark Twain</div> <!-- end .author -->
  <button class="newQuote">New Quote</button> <!-- end .newQuote -->

</div> <!-- end .container -->


* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Roboto;
  font-weight: 100;

a { text-decoration: none; }

.container {
  background-color: #049372;
  height: 100vh;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
 	transition: .3s all ease-in-out;

.socialMedia {
  position: absolute;
  height: 30px;
  width: 120px;
  top: 10px;
  left: 10px;

.socialIcon {
  height: 30px;
  width: 30px;
  margin-right: 10px;
.icon {
  height: 30px;
  opacity: .5;
  transition: .5s opacity ease-in-out;

.icon:hover { opacity: 1; }

.quoteBubble {
  max-width: 60vw;
  background-color: white;
  color: #049372;
  padding: 40px;
  margin-bottom: 40px;
  border-radius: 80px;
  position: relative;
  text-align: center;
  box-shadow: 10px 10px 15px 0 rgba(0,0,0,0.15);

.quoteBubble:after {
  content: "";
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 20px 20px 0 20px;
  border-color: white transparent transparent transparent;
  position: absolute;
  bottom: -20px;
  left: 50%;
  margin-left: -20px;

.quote {
  font-size: 2.5em;
  font-style: italic;
  float: left;
 	transition: .3s all ease-in-out;

.author {
  font-size: 1.75em;
  color: white;
  float: left;

.newQuote {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background-color: #049372;
  border: 1px solid white;
  color: white;
  padding: 5px 10px;
  text-transform: uppercase;
  font-weight: 300;
  opacity: .5;
  cursor: pointer;
  transition: .3s all ease-in-out

.newQuote:hover {
  opacity: 1;


                //////////////////////   LOAD DATA FROM API    //////////////////////////////////////
request = new XMLHttpRequest();"GET", "[orderby]=rand&filter[posts_per_page]=40", false);
request = [];

var currentQuote = "";

/////////////////    FUNCTION TO UPDATE THE QUOTE     ////////////////////////////////
function getQuote() {

  var randomQuote = [Math.floor(Math.random() * request.length)];


  currentQuote = request[randomQuote].content;
  // get size of quote
  var q = $(".quote").html().length;
  //alert (q);

  // if quote is to big, reduce font size
  if (q > 120) {
    $(".quote").css("font-size", "1.8em");
  } else {
    $(".quote").css("font-size", "2.5em");

////////////////////    DOCUMENT READY FUNCTION     ////////////////////////////////////
$(document).ready(function() {

  // get random quote

  // color array
  var colors = ["#D64541", "#C0392B", "#68C3A3", "#16A085", "#6C7A89", "#4183D7"];

  // get new quote on button click
  $('.newQuote').click(function() {

    // get a random color from the array
    var color = colors[Math.floor(Math.random() * colors.length)];
    // change colors
    $(".quote").css("color", color);
    $(".container").css("background-color", color);
    $(".newQuote").css("background-color", color);