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


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


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.


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.



		<link href='' rel='stylesheet' type='text/css'>

		<div class="wrap">
				<div class="header">
						<h1 class='text-primary text-center'>Random Quote Generator</h1>
						<div class="button-cntr">
								<button class="btn btn-large btn-primary getquote">
										Get New Quote

				<div class="jumbotron quote-container">
								<p id="quote" class="quote"></p>
								<cite id="author" class="author"> </cite>

				<div class="twitter-container">

						<button class="btn btn-primary btn-twitter" target="_blank"><i class="fa fa-twitter"></i> Tweet this quote</button>

		<!-- end wrap div -->
		<div class="footer">
				<p>Quotes provided by <a href=""></a></p>
				<p>This Codepen created as an example for <a href="" target="_blank"> <img src="" class="fcc-logo img-circle"></a> by <a href="" target="_blank">kurzninja</a>
		<!-- footer end -->



                h1 {
  font-family: Roboto, sans-serif;

.header {
	background-color: black;
	padding: 30px 0 0 0;
	margin: 0px;
	height: 200px;
body {
  background: url("");
  background-size: stretch;
	background-repeat: none;
	font-family: Roboto;
	height: 100%;
	margin-top: 0px !important;
		padding-top: 0px !imporant;

.quotes {
  display: block;
  font-size: 20px;
  color: #C00;
  margin-left: auto;
  margin-right: auto;
  text-align: center;

.getquote {
  display: block;
  margin-left: auto;
  margin-right: auto;  
  background-color: rgb(200,255,255);
  color: #000;
	border-top: 2px solid rgb(240,255,255);
	border-bottom: 2px solid rgb(150,205,205);
	border-left: none;
	border-right: none;
	border-radius: 20px;
	outline-style: none !important;

.getquote:active {
  background-color: rgb(100,155,155) !important;
  color: #000 !important;
	border-bottom: 2px solid rgb(240,255,255);
	border-top: 2px solid rgb(150,205,205);
	outline-style: none !important;

.getquote:focus {
  background-color: rgb(200,255,255);
  color: #000 !important;
	outline-style: none !important;
	border-bottom: 2px solid rgb(240,255,255);
	border-top: 2px solid rgb(150,205,205);

.getquote:hover {
  background-color: rgb(150,205,205);
  color: #000;
	border-top: 2px solid #ddd;
	border-bottom: 2px solid #333;
	outline-style: none !important;

.quote-container {
  height: 300px;
  background-color: rgba(20,24,41,.9);
  margin-left: auto;
  margin-right: auto;
  color: #eee;
  padding: 30px;
  text-align: justify;
  border-top: solid 5px #555;
	border-bottom: solid 5px #555;

.button-cntr {
  background-color: #CCC;
  margin-left: auto;
  margin-right: auto;
  margin-top: 10px;
  margin-bottom: 10px;
  width: 300px;
  height: 50px;
  border-radius: 5px;
  padding: 10px;

.footer {
  height: 100px;
  padding: 20px;
  width: 100%;
  background-color: #000;
  color: #666;  

.author {
  width: 100%;
  text-align: center !important;  
  font-size: 1.5em;
  font-style: italic;

.smaller-text {
  font-size: .8em;

.regular-text {
  font-size: 1.2em;

.larger-text {
  font-size: 2em;

.twitter-container {
  padding-top: 20px;
  text-align: center

.wrap {
        min-height: 100%;
        height: auto !important;
        height: 100%;
        /* Negative indent footer by it's height */
        margin: 0 auto -100px;

html {
	height: 100%;
		margin-top: 0px;
	padding-top: 0px;

.fcc-logo {
	height: 30px;
	width: 30px;


                $('document').ready(function() {

		var quotesArray = [];

		var currentURL = "[orderby]=rand&filter[posts_per_page]=20";

		var twitterEndpoint = "";

		var currentQuote = "";

		//parseData takes the JSON array and parses it into a useable {body, author} object
		function parseData(dataArray) {
						//testing that dataArray was passed properly
						//console.log("dataArray: " + dataArray);
						return {
								var content = elem['content'].replace(/(\<\/?p\>)|\n/g, "").trim();
								return {
										body: content,
										author: elem.title
								}; //return statement
						}); //map's anon function
				} //parsedata()

		//fillQuotesArray() takes the parsed JSON data objects and puts them into the array
		function fillQuotesArray(data) {
				//console.log("About to fill: " + JSON.stringify(data,null,2));
				quotesArray = parseData(data);

		//getQuotes fetches the JSON data with an API call
		function getQuotes(url) {
				return $.getJSON(url).then(fillQuotesArray);
				//testing that data was fetched
				//console.log("Got Data: " + JSON.stringify(data,null,2));

		function renderQuote(quote) {
				if (quote['body'].length > 450) {
				} else if (quote['body'].length < 100) {
				} else {

				$('#quote').html("&quot;" + quote.body + "&quot;");
				$('#author').html("&ndash; " +;


		function createTwitterURL(quoteText) {
				if (quoteText.length > 86) {
						quoteText = quoteText.slice(0, 83);
						while (quoteText[quoteText.length - 1] === " ") {
								quoteText = quoteText.slice(0, -1);
						quoteText = quoteText + "...";
				quoteText = '"' + quoteText + '"';
				var appendURL = encodeURIComponent(quoteText);
				var completeURL = twitterEndpoint + "?text=" + appendURL + "&hashtags=freecodecamp&url=";
				return completeURL;

		function setNextQuote() {
				currentQuote = quotesArray.shift();
				$('.btn-twitter').click(function() {
						var windowopts = "height=550,width=420,menubar=no,toolbar=no,personalbar=no,status=yes";['body']), windowopts);

		function newQuote() {
				quotesArray.length ? setNextQuote() : getQuotes(currentURL).then(setNextQuote);

		function updateQuote() {
				$('#quote').fadeOut(200, newQuote);

		$('.getquote').click(updateQuote); // .getquote .click  


}); // document.ready