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

Quick-add: + add another resource

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.

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="container-fluid">
  <div class="row text-center">
    <h1>Unsolicited Advice Generator</h1>
  </div>
  <div class="row text-center textbox">
    <div class="col-xs-12">
      <p id="quote">The message will go here.</p>
      
    </div>
    <div class="row text-center">
      <div class="col-xs-12">
        <div id="getMessage" class="btn newQuote">
          <i class="fa fa-comment"></i>More Advice
        </div>
        <a id="twitter" class="btn" title="Share this quote!" target="_blank"><i class="fa fa-twitter"></i>Tweet</a>
      </div>
      
    </div>
  </div>
  
  <p class="credit text-center">Advice provided by - <a href="http://adviceslip.com/">Adviceslip.com</a></p>
            
          
!
            
              @import url('https://fonts.googleapis.com/css?family=Comfortaa|Paytone+One|Elsie|Raleway');
body {
  font-family: 'Comfortaa', cursive;
  font-size: 16px;
  background: #a7779f;
}

h1 {
  font-family: 'Paytone One', cursive;
  color: #fff;
  font-size: 3em;
  margin: 50px 0;
  text-transform: uppercase;
}
credit, a, a:hover {
  color: #333;
}
.textbox {
  background: #fbf2ed;
  width: 600px;
  max-width: 100%;
  margin: 0 auto;
  padding: 80px 20px;
  border: .8em double #a7779f;
}
#quote {
  font-size: 1.6em;
  margin-bottom: 50px
}
.btn {
  background-color: #60365a;
  color: #fff;
  font-size: 1.2em;
  margin: .3em 1.2em;
}
.btn.focus, .btn:focus, .btn:hover {
  color: #fff;
  background-color: #732167;
}
.fa {
  margin-right: 8px;
}
            
          
!
            
              var html = "http://api.adviceslip.com/advice";
var getQuote = function(data) {
  $("#quote").text(data["slip"]["advice"]);

  updateTweet(data);
};

//Calls a random quote
$(document).ready(function() {
  $.getJSON(html, getQuote, "jsonp");
});

// New Quote button pulls new quote
$("#getMessage").click(function() {
  $.getJSON(html, getQuote, "jsonp");
});

//Share quote to Twitter
function updateTweet(data) {
  var thisQuote = data.slip.advice;
  $("#twitter").attr(
    "href",
    "https://twitter.com/intent/tweet?text=" + thisQuote + "- via @CandiceDavidson "
  );
}

            
          
!
999px
Loading ..................

Console