cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
                <div class="wrapper">
    <header class="color-1">
      lol machine 1.0
    </header>
    <div class="content">
      <div class="button color-1 shadowed" id="new-color"></div>
      <div class="quote color-1 shadowed" id="quote">
        <span><p style="margin: 0; text-align: center">LOL MACHINE (version 1.0)</p></span>
        <div class="quote-sign-open color-1">
          <svg viewBox="0 0 200 200">
            <path class="background" d="M43,25.4C28,36.1,29.1,49.5,32.7,50.2c3.1,0.4,6.3,1.3,8.9,3.8c5.1,5.1,5.4,13.4,0.2,18.5
              c-5.1,5.1-13.4,5.1-18.5,0c-7.8-8-4-23.7,2-33.5c2.7-4.5,6.5-10.3,16.1-15.4L43,25.4z M78.5,25.4c-15,10.7-13.8,24.1-10,24.8
              c2.9,0.4,6,1.3,8.7,3.8c5.1,5.1,5.4,13.4,0.2,18.5c-5.1,5.1-13.4,5.1-18.5,0c-7.8-8-4-23.7,2-33.5c2.7-4.5,6.5-10.3,16.3-15.4
              L78.5,25.4z"/>
          </svg>  
        </div>
      </div>
      <div class="author color-2 shadowed" id="author">
        <span>Touch the Sun to get started</span>
        <div class="quote-sign-close color-2">
          <svg viewBox="0 0 200 200">
            <path class="background" d="M22.2,74C36.8,63.5,35.7,50.5,32,49.8c-2.8-0.4-5.9-1.3-8.5-3.7c-5-5-5.2-13.1-0.2-18.1c5-5,13.1-5,18.1,0
              c7.6,7.8,3.9,23.1-2,32.7c-2.6,4.4-6.3,10-15.9,15L22.2,74z M56.9,74c14.6-10.5,13.5-23.5,10-24.2c-3.1-0.4-6.1-1.3-8.7-3.7
              c-5-5-5.2-13.1-0.2-18.1c5-5,13.1-5,18.1,0c7.6,7.8,3.9,23.1-2,32.7c-2.6,4.4-6.3,10-15.7,15L56.9,74z"/>
          </svg>  
        </div>
        <div class="share-buttons">        
          <a href="#" class="color-1 fa fa-twitter"></a>
          </a>
        </div>
      </div>        
      <div class="vector-bg">
        <svg viewBox="0 0 300 300">
          <g class="color-2">
            <g>
              <path class="st0" d="M155,296.9c18.3-10.1,48.2-7.9,62.7,0l11.1-17.1c-14.4-7.9-62.1-6.2-73.7,9.5c-10-15.9-59.3-17.4-73.7-9.5
                l11.1,17.1C106.8,289,136.7,286.9,155,296.9z"/>
              <path class="st0" d="M155,283.8c-3.6-9.5-25.9-23.9-69-29.9l0.9,6.1C86.9,260,142.9,263,155,283.8z"/>
            </g>
            <g>
              <path class="st0" d="M135.7,223.9c4.5-5.1,21.2-8.4,50.1-2.7l-1.3,2.2C184.5,223.4,148.1,213.7,135.7,223.9z"/>
              <path class="st0" d="M135.7,223.9c-0.7-6.8-12.6-19-39.6-30.9l-0.2,2.6C95.9,195.6,131.4,208.4,135.7,223.9z"/>
            </g>
            <g style="opacity: 0.7">
              <path class="st0" d="M135.4,154.3c-1.1-4.3-9.9-11-28.4-16l0.1,1.7C107.2,140,131.2,144.8,135.4,154.3z"/>
              <path class="st0" d="M135.5,155c2.3-3.8,12.7-7.6,31.9-6.9l-0.6,1.6C166.7,149.7,142.4,147.2,135.5,155z"/>
            </g>
            <g style="opacity: 0.5">
              <path class="st0" d="M137.6,94.1c-0.9-3.6-8.3-9.2-23.8-13.4l0.1,1.4C113.9,82.1,134,86.1,137.6,94.1z"/>
              <path class="st0" d="M137.7,94.7c2-3.1,10.7-6.3,26.7-5.8l-0.5,1.3C163.8,90.2,143.4,88.1,137.7,94.7z"/>
            </g>
            <g style="opacity: 0.3">
              <path class="st0" d="M138,46.9c-0.7-2.7-6.3-7-18.1-10.2l0.1,1.1C120,37.7,135.3,40.8,138,46.9z"/>
              <path class="st0" d="M138,47.3c1.5-2.4,8.1-4.8,20.3-4.4l-0.4,1C157.9,43.9,142.4,42.3,138,47.3z"/>
            </g>
          </g>
          <g class="color-1">
            <g>
              <path class="st1" d="M155,285.9c-5.2-8.8-30.1-22.6-73.7-21.2l2.3,7.9C83.6,272.6,139.6,267.4,155,285.9z"/>
              <path class="st1" d="M155,287c5.2-8.8,30.1-24.6,73.7-23.2c0,0-2,10-2.3,9.9C208.7,271.1,170.4,268.5,155,287z"/>
              <path class="st1" d="M155,280.9c-2.9-9.8-23.7-24.6-66.7-34.8l0.4,3.9C88.8,249.9,144.5,259.2,155,280.9z"/>
            </g>
            <g>
              <path class="st1" d="M163.7,258.6c-3.5-7.5-21.9-17-57.5-20.4l0.8,3.1C107,241.3,152.8,242.4,163.7,258.6z"/>
              <path class="st1" d="M164.1,259.9c3.1-7.7,21-18.1,56.5-23.1l-0.6,3.1C219.9,239.9,174.2,243.2,164.1,259.9z"/>
            </g>
            <g>
              <path class="st1" d="M165.4,185.2c-4.5-5.1-21.2-8.4-50.1-2.7l1.3,2.2C116.6,184.7,153,175,165.4,185.2z"/>
              <path class="st1" d="M165.3,186.4c0.8-6.8,12.9-18.8,40-30.4l0.1,2.6C205.4,158.6,169.8,171,165.3,186.4z"/>
            </g>
            <g style="opacity: 0.6">
              <path class="st1" d="M167.2,122.9c-2.1-3.1-11-5.8-27-4.5l0.6,1.3C140.7,119.6,161.1,116.6,167.2,122.9z"/>
              <path class="st1" d="M167.4,123.4c0.8-3.6,7.9-9.6,23.2-14.6l0,1.4C190.6,110.2,170.6,115.3,167.4,123.4z"/>
            </g>
            <g style="opacity: 0.4">
              <path class="st1" d="M164.2,69.2c-1.8-2.6-9.2-4.9-22.7-3.8l0.5,1.1C142,66.5,159.1,63.9,164.2,69.2z"/>
              <path class="st1" d="M164.4,69.7c0.7-3.1,6.6-8.1,19.4-12.2l0,1.2C183.8,58.6,167.1,62.8,164.4,69.7z"/>
            </g>
            <g style="opacity: 0.2">
              <path class="st1" d="M157.5,24.3c-1.4-2-7.1-3.8-17.4-2.9l0.4,0.8C140.5,22.2,153.6,20.3,157.5,24.3z"/>
              <path class="st1" d="M157.7,24.7c0.5-2.3,5.1-6.2,14.9-9.4l0,0.9C172.6,16.2,159.8,19.4,157.7,24.7z"/>
            </g>
          </g>
        </svg>
      </div>  
    </div>
    <footer class="background">
      <p>Copyright © 2016</p>
      <div class="social-section">
        <a href="https://github.com/Seybo" target="_blank" class="fa fa-github-alt" aria-hidden="true"></a>
        <a href="https://twitter.com/MichaelAtWSpace" target="_blank" class="fa fa-twitter-square" aria-hidden="true"></a>
        <a href="http://michaelatwork.space/" target="_blank" class="fa fa-home" aria-hidden="true"></a>
      </div>
      <p> Desing & Code by Michael Miro </p>
    </footer> 
  </div>
  
  <script src="script.js"></script>
            
          
!
            
              .wrapper {

  font-size: 2vmin;
  
  header, footer {
    height: 10vh;
    max-height: 50px;
    min-height: 20px;
    width: 100%;
    left: 0; 
    position: absolute; 
    text-align: center;
    display: flex; 
    justify-content: center;
    align-items: center; 

    max-width: 2000px;
    margin: auto;
    background: #d9e1e8;
  }

  header {
    top: 0;
    text-transform: uppercase;
    font-weight: bold;
    opacity: 0.5;
  }

  footer {
    bottom: 0;
    opacity: 0.3;
    justify-content: space-around;

    p, div {
      flex-basis: 33%;
    }
   
    .social-section {
      padding-left: 2vw; // to align with the book (visually)
      a {
        text-decoration: none;
        display: inline-block;
        padding: 0 1vw;
      }
    }
  }

  .shadowed {
    box-shadow: 0.2vw 0.2vw 0.2vw rgba(79, 75, 90, 0.5);
  }

  .content {
    
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;

    max-width: 2000px;
    position: relative;

    color: #d9e1e8;

    .button {
      z-index: 10;
      margin-bottom: -25vmin;
      margin-left: 1vmin; // to align with the book (visually)

      width: 10vmin;
      height: 10vmin;
      max-width: 60px;
      max-height: 60px;
      border-radius: 5vmin;

      background: #2b90d9;

      cursor: pointer;
      &:hover {
        transform: scale(1.1);
        transition: all .2s ease-in-out;  
      }

    }

    .quote, 
    .author {
      position: absolute;
      border-radius: 2vmin;
      padding: 2vmin;
      width: 30vw;
      max-width: 400px;
    }

    .quote {
      right: 59%;
      bottom: 50%;
      background: #2b90d9;
    }

    .author {
      left: 60%;
      bottom: 40%;
      font-style: italic;
      font-weight: bold;
      text-align: center;
      background: #9baec8;

      .share-buttons {
        a {
          position: absolute;
          background: #2b90d9;
          color: #d9e1e8; 
          font-size: 5vmin;
          bottom: -150%;
          right: 0%;
          text-decoration: none;
          border-radius: 3vmin;
          
          &:hover {
            transform: rotate(45deg);
            transition: all .2s ease-in-out;  
          }

        }
      }
    }

    .quote-sign-open, 
    .quote-sign-close {
      position: absolute;
      width: 6vmin;
      height: 6vmin;
      max-width: 50px;
      max-height: 50px;
      border-radius: 3vmin;
      bottom: -2vh;

      svg {
        width: 9vmin;
        display: block; 
        margin: 10% 10%;
        width: 150%;
        height: 150%;
        fill: white;
      }
    }

    .quote-sign-open {
      right: -5%;
      background: #2b90d9;
    }

    .quote-sign-close {
      left: -5%;
      background: #9baec8;
    }

    .vector-bg {

      svg {
        width: 80vmin;
        max-width: 600px;
        margin-top: 10vh;

        .color-1 {
          fill: #2b90d9;
        }

        .color-2 {
          fill: #9baec8;
        }
      }
    }
  }
}
            
          
!
            
              var JSONDataLoadScript = document.createElement("script");
JSONDataLoadScript.src = "https://codepen.io/Glaux/pen/xOoGYW.js";
document.body.appendChild(JSONDataLoadScript);

// these two functions are called from data.js file
// and they contain all the JSON data 
function loadColorSchemes(data) {
  colorsData = data;
}

function loadQuotes(data) {
  quotesData = data;
}

var newColorButton = document.querySelector("#new-color");

var colorsData = null;
var quotesData = null;
var lastSchemeNumber = 999;

newColorButton.addEventListener("click", function() {
  change();
});

function change() {

  var elementsWithColor1 = $(".color-1");
  var elementsWithColor2 = $(".color-2");
  var elementsWithBGColor = $(".background");
  var elementsWithShadow = $(".shadowed");

  function randomNumberWithinRange(min, max) {
    return Math.floor(Math.random() * (max - min + 1)) + min;
  }

  function changeColors() {
    var scheme_number = randomNumberWithinRange(0, colorsData.length-1);

    while (scheme_number === lastSchemeNumber){
       scheme_number = randomNumberWithinRange(0, colorsData.length-1);
    }

    lastSchemeNumber = scheme_number;

    $("body").css("background", colorsData[scheme_number].background);
    $("body").css("transition", "all 1s");

    elementsWithColor1.css("background", colorsData[scheme_number].color1);
    elementsWithColor1.css("fill", colorsData[scheme_number].color1);
    elementsWithColor1.css("color", colorsData[scheme_number].background);
    elementsWithColor1.css("transition", "all 0.5s");

    elementsWithColor2.css("background", colorsData[scheme_number].color2);
    elementsWithColor2.css("fill", colorsData[scheme_number].color2);
    elementsWithColor2.css("color", colorsData[scheme_number].background);
    elementsWithColor2.css("transition", "all 0.5s");

    elementsWithShadow.css("boxShadow", colorsData[scheme_number].shadow);
    elementsWithShadow.css("transition", "all 0.5s");

    elementsWithBGColor.css("fill", colorsData[scheme_number].background);
    elementsWithBGColor.css("transition", "all 0.5s");
  }

  function changeQuote() {
    var quote_number = randomNumberWithinRange(0, quotesData.length-1);

    $("#quote span").text(quotesData[quote_number].quote);
    $("#author span").text(quotesData[quote_number].author);

    function updateTwitterButton() {
      var twitterButton = $(".fa-twitter");
      twitterButton.attr("href", "https://twitter.com/intent/tweet?hashtags=funnyquotes&text=" + "\"" + quotesData[quote_number].quote + "\" " + quotesData[quote_number].author);
      twitterButton.attr("target", "blank");
    }
    
    updateTwitterButton();

  }

  changeColors();
  changeQuote();
}
            
          
!
999px
Loading ..................

Console