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.

            
              <html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Quote Machine</title>  
</head>

<body>

    <!-- Purple Box -->
    <div class="backPurple">

        <img class="quoteLogo img-responsive" src="http://www.jprades.net/wp-content/uploads/2016/10/Logo.png" alt="Quote Machine Generator Logo"/>

    </div>

    <!-- Column Quote Box -->
    <div class="row">

        <div class="col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3 col-xs-12">

            <div id="quoteBox">
                <i class="fa fa-quote-left iconFa"> </i>

                <div class="codeQuote">
                </div> <!--codeQuote-->

                <div class="author">
                </div> <!-- author-->
                
            </div> <!--Quote Box-->

            <div class="row">

                <!-- Twitter Btn Column-->
                <div class="col-md-6" align="middle">
                    <a href="#" id="twitterBtn"
                       class="btn btn-social-icon btn-lg btn-twitter"
                       target="_blank"><span class="fa fa-twitter"></span></a>


                </div> <!--twitter btn-->


                <!-- Btn Generator Column-->
                <div class="col-md-6" align="middle">
                    <button id="buttonGenerator" class="btn btn-default btn-lg">
                        <b>Generate Quote</b></button>

                </div> <!--btn generator-->
            </div> <!--Sub Row-->
        </div> <!-- Principal Column-->
    </div> <!--Principal row-->

    <div class="row">
        <div class="col-md-3 col-md-offset-9">
            <h4 align="center">by <a href="https://codepen.io/Smukat/"><b>Jessica Prades</b></a></h4>
        </div>

    </div> <!--row credits-->


</body>
</html>
            
          
!
            
              .backPurple {
    background-color: #57068c;
    padding-bottom: 180px;
}

.quoteLogo {
    padding-top: 20px;
}

#quoteBox {

    border-color: black;
    border-width: thin;
    border-style: solid;
    background-color: white;
    margin-top: -160px;
    height: 400px;
}

.iconFa {
    padding-top: 50px;
    padding-left: 20px;
    font-size: 35px;
}

.codeQuote {
    margin-top: 20px;
    padding-left: 55px;
    padding-right: 30px;
    font-size: 25px;
    font-family: Galano Grotesque Alt DEMO, Galano Grotesque DEMO ,sans-serif;
    text-align: center  ;
}

.author {
    font-family: Galano Grotesque Alt DEMO, Galano Grotesque DEMO ,sans-serif;
    text-align: right;
    font-size: 20px;
    padding-right: 25px;
    margin-top: 40px;
    margin-bottom: 10px;
}

#buttonGenerator {
    margin-top: 20px;
    margin-bottom: 20px;
}

.btn-twitter {
    color: #fff;
    background-color: #55acee;
    margin-top: 20px;
    margin-bottom: 20px;
}

a {
    color: #57068c;
}


            
          
!
            
              /**
 * Created by Jessica Prades on 10/26/2016.
 */

/* Generate a Random number*/
function getRandomNumber(min, max) {
    return Math.floor(Math.random() * (max - min)) + min;
}

/* Generate a random quote and his author*/
function generateQuote() {

    var arrQuotes = ["Programs must be written for people to read, and only incidentally for machines to execute.", "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live", "That's the thing about people who think they hate computers. What they really hate is lousy programmers.", "You've baked a really lovely cake, but then you've used dog shit for frosting.", "Give a man a program, frustrate him for a day.Teach a man to program, frustrate him for a lifetime.", "I'm not a great programmer; I'm just a good programmer with great habits.", "How you look at it is pretty much how you'll see it", "A language that doesn't affect the way you think about programming is not worth knowing.", "Perl – The only language that looks the same before and after RSA encryption.", "Walking on water and developing software from a specification are easy if both are frozen.", "The most disastrous thing that you can ever learn is your first programming language.", "The most important property of a program is whether it accomplishes the intention of its user.", "Big Brother fills us all with the same crap. My guess is he was clever the same way everybody thinks they're clever.", "At forty, I was too old to work as a programmer myself anymore; writing code is a young person’s job."];
    var arrAuthors = ["Harold Abelson", "John Woods", " Larry Niven", "Steve Jobs", "Waseem Latif", "Kent Beck", "Rasheed Ogunlaru", "Alan J. Perlis", "Keith Bostic", "Edward Berard", "Alan Kay", "C.A.R. Hoare", "Chuck Palahniuk, Lullaby", "Michael Crichton, Prey"];

    var n = getRandomNumber(0, arrQuotes.length);

    $(".codeQuote").html(arrQuotes[n]);
    $(".author").html("- " + arrAuthors[n]);

    /* Twitter Button */

    var totalLength = arrQuotes[n].length + arrAuthors[n].length + 3;

    if (totalLength > 140) {

        arrQuotes[n] = arrQuotes[n].substring(0, (140 - arrAuthors[n].length - 6)) + "...";
    }

    $("#twitterBtn").attr("href", "https://twitter.com/intent/tweet?text=" + arrQuotes[n] + " - " + arrAuthors[n]);

}

/* Calling the Function*/

$(document).ready(function () {
    generateQuote();


    $("#buttonGenerator").on("click", generateQuote);

});
            
          
!
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