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>
        <div id="machine-container">
            <div id="title-container">
                <h1 id="page-title">Random Quote Machine</h1>
                <h2 id="second-title">Powered by Chuck Norris</h2>
            </div>
            <div id="quote-screen">
                <p id="quote">
                    Click the button Below to generate quote!
                    <span id="line">|</span>
                </p>
            </div>
            <div id="button-container">
                <button class="machine-btn" id="quoteBtn">Get Inspired!</button>
                <a class="btn machine-btn" id="tweetBtn" target="_blank" href="">Tweet!</a>
            </div>
        </div>
    </div>

    <script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
    
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700|VT323|Orbitron:400,900);
body {
    font-family: 'Orbitron';
    margin-top: 15vh;
    text-align: center;
    min-height: 85vh;
    background: #1c1c1c;
    /* fallback for old browsers */
    background: -webkit-linear-gradient(to right, #1c1c1c, #37353d, #1c1c1c);
    /* Chrome 10-25, Safari 5.1-6 */
    background: linear-gradient(to right, #1c1c1c, #37353d, #1c1c1c);
    /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
}

#title-container {
    background-color: #181818;
    background: repeating-linear-gradient(180deg, #252525 0%, #252525 10%, #181818 0%, #181818 50%) 0 / 10px 10px;
    margin: 1em auto;
    font-weight: bold;
    width: 800px;
    border: rgba(81, 198, 219, 0.7) 1px solid;
    color: rgba(90, 214, 237, 0.75);
    text-shadow: 0 0 1px #e6f9e6, 0 0 10px #3cd834, 0 0 10px #3cd834;

    -webkit-box-shadow: 0 0 2px #e6f9e6, 0 0 3px #3cd834, 0 0 3px #3cd834, 0 0 5px #4bf742, 0 0 5px #4bf742;
    -moz-box-shadow: 0 0 2px #e6f9e6, 0 0 3px #3cd834, 0 0 3px #3cd834, 0 0 5px #4bf742, 0 0 5px #4bf742;
    box-shadow: 0 0 2px #e6f9e6, 0 0 3px #3cd834, 0 0 3px #3cd834, 0 0 5px #4bf742, 0 0 5px #4bf742;
}

#page-title {
    font-size: 3em;
}

#second-title {
    margin-top: 10px;
    font-size: 1em;
}
#machine-container {
    margin: auto;
    background-color: #181818;
    background: repeating-linear-gradient(180deg, #252525 0%, #252525 10%, #181818 0%, #181818 50%) 0 / 10px 10px;
    
    border: rgba(81, 198, 219, 0.7) 1px solid; 
    -webkit-box-shadow: 0 0 2px #e6f9e6,0 0 5px #3cd834, 0 0 5px #3cd834, 0 0 10px #4bf742, 0 0 10px #4bf742;
    -moz-box-shadow:   0 0 2px #e6f9e6,0 0 5px #3cd834, 0 0 5px #3cd834, 0 0 10px #4bf742, 0 0 10px #4bf742;
    box-shadow:    0 0 2px #e6f9e6,0 0 5px #3cd834, 0 0 5px #3cd834, 0 0 10px #4bf742, 0 0 10px #4bf742;

    justify-content:  center;
    margin: auto;
    padding: 5px;
    width:820px;
    text-align: center;
    justify-content:  center;
}
/* min-height: 78vh; */
#quote-screen{
    
    text-align: center;
    justify-content:  center;
    margin: auto;
    padding: 0.5em;
    width:800px;
    min-height: 400px;
    max-height: 400px;
    background-color: #181818;
    background: repeating-linear-gradient(180deg, #252525 0%, #252525 10%, #181818 0%, #181818 50%) 0 / 10px 10px;
    border: rgba(81, 198, 219, 0.7) 1px solid; 
    -webkit-box-shadow:  0 0 2px #e6f9e6,0 0 5px #3cd834, 0 0 5px #3cd834, 0 0 10px #4bf742, 0 0 10px #4bf742;
    -moz-box-shadow:   0 0 2px #e6f9e6,0 0 5px #3cd834, 0 0 5px #3cd834, 0 0 10px #4bf742, 0 0 10px #4bf742;
    box-shadow:    0 0 2px #e6f9e6,0 0 5px #3cd834, 0 0 5px #3cd834, 0 0 10px #4bf742, 0 0 10px #4bf742;
}
#quote {
    font-size: 2em;
    color: rgba(90, 252, 252, 0.7);
    text-shadow:  0 0 2px #e6f9e6,0 0 5px #3cd834, 0 0 10px #3cd834, 0 0 50px #4bf742, 0 0 50px #4bf742;
    width: 100%;
    text-align: left;
}
.typing-animation{
    
    white-space: nowrap;
    overflow: hidden;
    width: 30em;
    animation: type 1s steps(60, end);
}
#line{
    animation: blink 1s infinite;
}

@keyframes type {
    from {
      width: 0px;
    }
  }
  @keyframes blink {
    to {
      opacity: .0;
    }
  }
.machine-btn{
    color: #181818;
    text-shadow:  0 0 2px #e6f9e6,0 0 5px #89ecff, 0 0 10px #3cd834, 0 0 50px #60e6ff, 0 0 50px #60e6ff;
    text-decoration: none;
    -webkit-transition: all 0.5s;
    -moz-transition: all 0.5s;
    transition: all 0.5s;
    font-family: Orbitron;
    font-weight: bold;
    font-size: 2em;
    background: rgba(89, 252, 216, 0.6);
    border-radius:1px;
    -webkit-transition: all 1000ms cubic-bezier(0.390, 0.500, 0.150, 1.360);
    -moz-transition: all 1000ms cubic-bezier(0.390, 0.500, 0.150, 1.360);
    -ms-transition: all 1000ms cubic-bezier(0.390, 0.500, 0.150, 1.360);
    -o-transition: all 1000ms cubic-bezier(0.390, 0.500, 0.150, 1.360);
    transition: all 1000ms cubic-bezier(0.390, 0.500, 0.150, 1.360);
}
.machine-btn:hover{
    color: rgba(255, 255, 255, 0.85);
    box-shadow: #155635 0 0px 0px 40px inset;
    -webkit-animation: buttonGlow 1.5s ease-in-out infinite alternate;
    -moz-animation: buttonGlow 1.5s ease-in-out infinite alternate;
    animation: buttonGlow 1.5s ease-in-out infinite alternate;
}
#quoteBtn{
    margin-top:10px;
    background: transparent;
    border: none;
    background: rgba(89, 252, 216, 0.6);
    padding:5px;
  }
#tweetBtn{
    margin-top:-12px;
    -webkit-animation: none;
    -moz-animation: none;
    animation: none;
    
}


/* font animation*/

/*glow for mozilla*/
  
  @-moz-keyframes buttonGlow {
    from {
      text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #fff, 0 0 40px #228DFF, 0 0 70px #228DFF, 0 0 80px #228DFF, 0 0 100px #228DFF, 0 0 150px #228DFF;
    }
    to {
      text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #fff, 0 0 20px #228DFF, 0 0 35px #228DFF, 0 0 40px #228DFF, 0 0 50px #228DFF, 0 0 75px #228DFF;
    }
  }
  
  @keyframes buttonGlow {
    from {
      text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #fff, 0 0 40px #228DFF, 0 0 70px #228DFF, 0 0 80px #228DFF, 0 0 100px #228DFF, 0 0 150px #228DFF;
    }
    to {
      text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #fff, 0 0 20px #228DFF, 0 0 35px #228DFF, 0 0 40px #228DFF, 0 0 50px #228DFF, 0 0 75px #228DFF;
    }
  }

@media screen and (max-width:1280px) {
    body {
        margin-top: 80px;
        margin-bottom: 20px;
    }
    #quote {
        font-size: 1.5em;
    }
    #title-container{
        width:650px;
    }
    #quote-screen{
        width:650px;
    }
    #machine-container {
        width:665px;
    }
}

@media screen and (max-width:720px) {
    body {
        margin-top: 50px;
        margin-bottom: 30px;
    }
    #machine-container {
        width:445px;
    }
    #title-container{
        width:400px;
    }
    #quote{
        font-size:1.3em;
    }
    #quote-screen{
        width:400px;
    }
    .machine-btn{
        font-size: 1.3em;
    }
    #quoteBtn{
        padding:6px;
      }
    #tweetBtn{
        margin-top:-2px;
        
    }
}

@media screen and (max-width:420px) {
    #quote {
        font-size: 1em;
    }
    #title-container{
        width:300px;
    }
    #quote-screen{
        width:300px;
    }
    #machine-container {
        width:310px;
    }
}

              
            
!

JS

              
                const $quote = document.getElementById('quote');

$('#quoteBtn').click(() => {
    changeQuote();
})

function changeQuote() {
    const jokeApi = "https://api.icndb.com/jokes/random";
    try {
        $.get(jokeApi, (data) => {
            $('#quote').html(data["value"]["joke"]);
            $('#quote').append("<span id='line'>&#9646;</span>");
        });
    } catch (err) {
        console.log(err)
    }
    typingAnimation();
}

$('#tweetBtn').bind('click', function () {
    const twitterLink = "https://twitter.com/intent/tweet?hashtags=quotes&text"
    let quote = $('#quote').innerHTML();
    $('#tweetBtn').attr("href", twitterLink + encodeURIComponent(quote));
});

let typingAnimation = (function typing() {
    $quote.classList.add('typing-animation');
    timer = setTimeout(function () {
        $quote.classList.remove('typing-animation');
    }, 3000);
    return typing
}())
              
            
!
999px

Console