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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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 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

              
                <div class="container-fluid">
  <div class = "row text-center flex">
    <section class="box col-sm-6 col-sm-offset-3 block-center align-middle">
      <div>
        <h2>Get A Random Design Quote</h2>
      </div>
      <div>
        <div>
          <div class = "row text-center">
           <h4 class="blockquote" id="quote-content"></h4><br>
           <p id="quote-title"></p><br>
           <pre class="col-sm-4 col-sm-offset-4" id="quote-source"></pre>
          </div>
          <div class = "row">
           <div class = "col-sm-6 text-left">
             <a id="btnTweet" href="#"><i class="fa fa-twitter fa-3x"></i></a>
          </div>
           <div class = "col-sm-6 text-right">
            <button id = "getMessage" class = "btn btn-primary">Get Message</button>
           </div>
          </div>
         </div>
      </section>
      </div>
    </div>
  </div>
</div>

              
            
!

CSS

              
                html, body{
    height:100%;
    margin:0;
    padding:0;
}
.row{
 
    vertical-align: middle;
}
body{
  color:#fff;
  background:url('https://bhrbusinesscenter.com/wp-content/uploads/sites/2/2017/06/tileable-midnight-blue-grunge-patterns-11-300x300.jpg');
}
.box{
  
  border-radius:30px;
  margin-top:3em;
  padding:0 6em;
  background-color:rgba(0,0,0,.5);
}
#quote-title{
  color:#999;
}

.show{
  display:block;
}
.hidden, pre{
  display:none;
}
.fa-quote-right{
  float:right;
  margin-top:-20px;
}
.fa-quote-left{
  float:left;
  margin-top:-10px;
}
              
            
!

JS

              
                
$(document).ready(function() {
   /*  if ($("#quote-source").html().trim() === ""){
    $('#quote-source').addClass("hide");
  } else {
    $('#quote-source').addClass("show");
  }
   */

  $('#getMessage').on('click', function(e) {
    
    e.preventDefault();
    $.ajax( {
      
         url: 'https://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1',
        success: function(data) {
         var post = data.shift();
         $('#quote-title').text("-" + post.title);
         $('#quote-content').html("<i class='fa fa-quote-left'></i>" + post.content + "<i class='fa fa-quote-right'></i>");
         
       if (typeof post.custom_meta !== 'undefined' && typeof post.custom_meta.Source !== 'undefined') {
          $('#quote-source').html('Source:' + post.custom_meta.Source);
        } else {
          $('#quote-source').addClass("hidden");
        }
      },
      cache: false
    });
  });

     $('#btnTweet').click(function (e) {
    
     var textToTweet = $("#quote-content").text();
      var tweetAuthor = $("#quote-title").text();
     if (textToTweet.length > 140) {
       alert('Tweet should be less than 140 Chars');
       }
       else {
       var twtLink = 'http://twitter.com/share?text=' + encodeURIComponent(textToTweet) + '--' + tweetAuthor;
     window.open(twtLink,'_blank');
     }
     
   });
});
              
            
!
999px

Console