Pen Settings

HTML

CSS

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

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

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.

HTML

              
                
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Random Quote Generator </title>
    <!-- google fonts  -->
    <link href="https://fonts.googleapis.com/css?family=Cormorant+Upright|Josefin+Slab|Raleway" rel="stylesheet">
    <!-- font awesome  -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <!-- main css file  -->
    <link rel="stylesheet" href="css/main.css">
</head>

<body>
    <!-- main section  -->
    <section class="main">
        <!-- quote section  -->
        <section class="quote-container">
            <!-- title  -->
            <h1 class="title">Random || Quote || Generator</h1>
            <!-- end title -->
            <div class="quote">
                <p class="quote-text">
                    <span class="fa fa-quote-left fa-4x" aria-hidden="true"></span>
                    <span id="quote-text">Best not make any more threats to your
                     website. It will be met with fire and fury like the world has never seen. I will write some great placeholder
                    text – and nobody writes better placeholder text than me, believe me – and I’ll write it very inexpensively.
                    I will write some great, great text on your website’s Southern border, and I will make Google pay for
                    that text. Mark my words. You could see there was text coming out of her eyes, text coming out of her
                    wherever.</span>
                    <span class="fa fa-quote-right fa-4x" aria-hidden="true"></span>
                </p>
                <p class="quote-author">- <span id="quote-author">Knuth Rockne All American</span></p>
            </div>
            <!--quote button section   -->
            <div class="quote-button-container">
                <!-- twitter share  button-->
                <a href="#" class="button" target="_blank" id="twitter"> <span class="fa fa-twitter-square fa-2x" aria-hidden="true"></span></a>
                <!-- twitter button end  -->
                <!-- Facebook share button  -->
<!--                 <a href="#" class="button" target="_blank" id="facebook"><span  class="fa fa-facebook-square fa-2x" aria-hidden="true"></span></a> -->
                <!-- end Facebook share button  -->
                <input type="button" class="button button-quote" id="quote-button" value="New Quote">
            </div>
            <!-- quote button end  -->
        </section>
        <!-- end quote section -->
        <!-- author -->
        <div class="made">
            Made by : <a href="https://leamsigc.github.io" target="_blank">Ismael Garcia</a>
        </div>
    </section>
    <!-- end main section  -->
    <!-- main js file  -->
<!--     <script src="js/main.js"></script> -->
</body>

</html>
              
            
!

CSS

              
                // +++++++++++++++general css =================
// font-family: 'Cormorant Upright', serif;
// font-family: 'Josefin Slab', serif;
// font-family: 'Raleway', sans-serif;
* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    text-align: center;
    font-size: 16px;
    font-family: 'Raleway', sans-serif;
    color: rgb(183, 215, 217); // background: url();
    // background:linear-gradient(45deg , rgba(rgba(12, 160, 169, 0.37), 0.3) , rgba(7, 179, 153, 0.90)50%,rgba(97, 11, 90, 0.79)90%);
    background: #606c88;
    /* fallback for old browsers */
    background: -webkit-linear-gradient(to bottom, #3f4c6b, #606c88);
    /* Chrome 10-25, Safari 5.1-6 */
    background: linear-gradient(to bottom, #3f4c6b, #606c88);
    /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
    background-repeat: no-repeat;
}

p {
    line-height: 150%;
}

a {
    text-decoration: none;
    color: #f7f7f7;
}

// ---------------General css end -------------
// ======main css=========
.main {
    background: rgba(#000, 0.3);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

// ========qoute container css========
.quote-container {
    max-width: 800px;
    width: 100%;
    display: flex;
    justify-content: space-around;
    flex-direction: column;
    padding: 20px;
    background: rgba(#000, 0.3);
    border-radius: 5px;
    box-shadow: 5px 2px 11px 1px rgba(36, 37, 41, 0.57);
}

// =====title css=======
.title {
    width: 100%;
    font-size: 2.5em;
    font-family: 'Josefin Slab', serif;
    padding: 20px;
    margin-bottom: 80px;
}

.quote-text {
    transition: all 0.5s ease;
    padding: 10px;
    margin-top: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-around;
    p{
        flex: auto;
    }
    .fa {
        padding: 5px;
    }
    .fa-quote-left {
        margin-top: -30px;
    }
}

.quote-text .fa-quote-right {
    align-self: flex-end;
    margin-bottom: -30px;
}

// ======quote author =====
.quote-author {
    transition: all 0.5s ease;
    text-align: right;
    padding: 20px;
    font-family: 'Cormorant Upright', serif;
}

// ======== quote-button-container ============
.quote-button-container {
    padding: 10px;
    display: flex;
    width: 100%;
    transition: all 0.5s ease;
    .button {
        padding: 10px 15px;
        border: 1px solid rgba(#000, 0.3);
        margin: 10px;
        color: rgba(5, 160, 242, 0.59);
        background: rgba(255, 255, 255, 0.12);
        border-radius: 5px;
        transition: all .3s ease;
        flex-basis: 50px;
        &:hover {
            background: rgba(#000, 0.3);
            color: rgba(5, 160, 242, 0.59);
        }
    }
    .button-quote {
        margin-left: auto;
        flex-basis: 300px;
        font-size: 1.5em;
        font-family: 'Cormorant Upright', serif;
        &:hover {
            color: #f2f2f2;
        }
    }
}
.made{
    font-family: 'Cormorant Upright', serif;
}
// media querys
@media (max-width:799px) {
    body {
        font-size: 13px;
    }
}

@media (max-width:500px) {
    body {
        font-size: 10px;
    }
    .quote-container {
        padding: 5px;
    }
    .title {
        margin: 10px 0;
    }
    .quote-button-container {
        flex-wrap: wrap;
        .button {
            flex-basis: 20%;
            margin: 2px;
        }
        .button-quote {
            flex-basis: 40%;
            margin-left: auto;
        }
    }
}
              
            
!

JS

              
                //window load and run the js 
window.addEventListener('load',() => {
    //quote button ;
    const btnQ = document.getElementById("quote-button");
    //add event listener to the btn-quote ;
    btnQ.addEventListener('click', randomQuote);//click and call the random quote  function ;
    // random quote function ;
    function randomQuote () {
        const hastags = 'freecodecamp#leamsigc#quoteGenerator'
        const textQuote = document.getElementById('quote-text');//text quote ;
        //quote autor ;
        const quoteAutor = document.getElementById('quote-author');
        //twitter share button ;
        const twitter = document.getElementById('twitter');
        //facebook share button ;
        // const facebook = document.getElementById('facebook');
        //get quote api ;
        let url="https://talaikis.com/api/quotes/random/";//url api;
        //https://talaikis.com/random_quotes_api/ quote api ..;
        fetch(url)
            .then( response => {
                return response.json();//convert the response to json data ;
            })
            .then(data => {
                console.log(data);//console log the data ;
                textQuote.textContent=data["quote"];//data quote to text quote ;
                quoteAutor.textContent=data["author"];//quote author ;
                //set attribute for share twitter 
                twitter.setAttribute('href' , `https://twitter.com/home/?status=${data['quote']}(${data.author})&${hastags}`);
                // facebook.setAttribute('href' , `https://facebook.com/home/?status=${data['quote']}(${data.author})`);
            })
            .catch(function(err) {//if any error we can see it in the console ;
                // Error :(
                    console.log(err);
                    textQuote.textContent=err;
        });
    }
});



              
            
!
999px

Console