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="colored-name title">Random Quote Machine
      </div>

      <div class="quote-container">
        
        <div class="quote">
          Here be quote.
        </div>
        
        <div class="author">
          Mr. B
        </div>
        
        <div class="quote-separator"></div>

        <div class="button-row">
          <span class="fa fa-twitter fa-2x tweet link"></span>
          <span class="fa fa-refresh fa-2x refresh link"></span>
        </div>
        
      </div>
      
      <div class="row footer-content">
        <span class="colored-name">by
        <a href="http://balach.de" class="link" target="_blank">
        <span class="colored-name"> Balach</span>
        </a>
        </span>
      </div>
      <div class="zipline-description">
          The is the random quote machine, built for my Free Code Camp Zipline. <br>I have used the quote API from <a href="https://quotes.stormconsultancy.co.uk/api" class="link" target="_blank">Storm Consultancy</a>, fonts from Google Fonts, and a lot of inspiration from other FCC campers.
      </div>
            
          
!
            
              body {
	background-color: rgba(245,245,245,0.6);
	font-family: 'Josefin Sans', sans-serif;
	font-size: medium;
	color: rgb(52, 52, 52);
	width: 90%;
	height: 100%;
	margin:auto;
	text-align: center;
}

.title {
	font-family: Tangerine,Serif;
	font-size: 5em;
	text-shadow: #000 1px 1px;
	margin: 0.5em;
}
.zipline-description {
	font-size: 0.8em;
}

.quote-container {
	background-color: rgba(255, 235, 59, 0.41);
    border-radius: 16px 16px 2px 16px;
    margin-bottom: 1em;
    min-height: 60%;
    border: #607d8b solid 0.2em;
}
.quote {
	padding: 1em;
	font-size: 2.2em;
	text-shadow: rgba(245,245,245,0.6) 0px 0px 3px;
	vertical-align: middle;
}
.author {
	padding: 0em 1em 0.4em 0em;
	text-align: right;
	font-size: 1.8em;
	text-shadow: rgba(245,245,245,0.6) 0px 0px 3px;
}
.quote-separator {
	width: 80%;
	margin: auto;
	border-top: #9e9e9e solid 0.1em;
}

.button-row {
	height: 3em;
}

.refresh {
	margin: 0.3em 5em 0.3em 1em;
	float: right;
}
.tweet {
	margin: 0.3em 1em 0.3em 5em;
	float: left;
}

.link {
	cursor: pointer;
	text-decoration: none;
	color: #337ab7;
}
.link:hover {
	text-decoration: none;
	color: #225d90;
	text-shadow: rgba(0,0,0,0.6) 0px 0px 1px;
}

.colored-name {
  color: #E74C3C;
  font-weight: bold;
}
            
          
!
            
              // Start the engines
$(document).ready(function(){
	// Load first quote
	getQuote();
	// Set up the refresh button
	$(".refresh").on("click", function() {
	getQuote();
	$(".refresh").addClass("fa-spin");
	});
	// Set up tweet click handler
	$(".tweet").on("click", function(){
		window.open($(this).attr("tweet"), "_blank")
	});
});

function getQuote(){
	// get random quote from storm consultancy
	$.get("https://crossorigin.me/https://quotes.stormconsultancy.co.uk/random.json?" + Date.now())
		.done(function(data){
			// Pass the quote info to the handler
			setQuote(data.quote, data.author);
		})
		.fail(function() {
			// Set my own quote in case of failure or api rate-limit hit
			setQuote("The only good time to hit the API rate-limit is when you are trying to hit it.", "Balach");
		})
		.always(function() {
			// Always stop spinning when done whatever the reason
			$(".refresh").removeClass("fa-spin");
		});
}

function setQuote(quote, author){
	// Set quote and author in visually appealing way
  quote.replace(";", ",");
	$(".quote").html(quote).fadeIn();
	$(".author").html(author).fadeIn();

	// Set up the tweet button with new quote
	var tweet = "https://twitter.com/intent/tweet?text=" + encodeURI(quote + "-" + author) + "&via=balatsch&related=FreeCodeCamp";
	$(".tweet").attr( "tweet", tweet);
}
            
          
!
999px
Loading ..................

Console