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

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

              
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
<script>
	window.fbAsyncInit = function() {
		FB.init({
			appId: '391950400975243',
			xfbml: true,
			version: 'v2.6'
		});
	};

	(function(d, s, id) {
		var js, fjs = d.getElementsByTagName(s)[0];
		if (d.getElementById(id)) {
			return;
		}
		js = d.createElement(s);
		js.id = id;
		js.src = "//connect.facebook.net/en_US/sdk.js";
		fjs.parentNode.insertBefore(js, fjs);
	}(document, 'script', 'facebook-jssdk'));
</script>
<div class="center-wrap">
	<div class="quote-wrapper">
		<div class="text-wrap">
			<p class="quote-text" id="quote">
				<span id="custom-quotation-mark">...<i class="fa fa-quote-left"> </i></span>
			</p>
			<br>
			<h3 class="quote-author" id="author"></h3>
		</div>
	</div>
	<div class="buttons-wrap">
		<button class="btn btn-primary outline button-row" id="quote-button" type="button"><span style="font-family: 'PT Serif', serif; margin:0px -4px; font-size:14px;">New Quote</span></button>

		<a class="btn btn-primary outline button-row" id="post-twitter" title="Tweet this quote!" target="_blank">
			<i class="fa fa-twitter" style="margin:0px -3px; z-index:9999; "></i>
		</a>

		<a class="btn btn-primary outline button-row" id="post-facebook" title="Post this quote to Facebook!" target="_blank">
			<i class="fa fa-facebook" style="margin:0px -1px; z-index:9999;"></i>
		</a>
	</div>
</div>
</div>
              
            
!

CSS

              
                @import 'https://fonts.googleapis.com/css?family=PT+Serif';
@import 'https://fonts.googleapis.com/css?family=Cormorant+Infant';
@import 'https://fonts.googleapis.com/css?family=David+Libre';
body:before {
	content: ' ';
	display: block;
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	z-index: -1;
	/* Keep picture behind black background */
	opacity: 0.4;
	/* merge with background */
	background-image: url('http://www.magic4walls.com/wp-content/uploads/2014/04/bridge-lake-pier-city-night-lights-macro-photo-blur-hd-wallpaper.jpg');
	background-repeat: no-repeat;
	background-attachment: fixed;
	background-position: 30% 10%;
	-ms-background-size: cover;
	-o-background-size: cover;
	-moz-background-size: cover;
	-webkit-background-size: cover;
	background-size: cover;
	overflow-x: hidden;
	min-height: 750px;
	/* protects from height resizing */
}

body {
	padding-top: 170px;
	background: #000;
}

.center-wrap {
	width: 460px;
	position: relative;
	margin: 0 auto;
}

.quote-wrapper {
	position: inherit;
	background: rgba(0, 251, 251, 0.6);
	/* For browsers that do not support gradients */
	background: linear-gradient(to right, rgba(0, 251, 251, 0.6), rgba(35, 138, 169, 0.6));
	background: -webkit-linear-gradient(left, rgba(0, 251, 251, 0.6), rgba(35, 138, 169, 0.6));
	background: -o-linear-gradient(right, rgba(0, 251, 251, 0.6), rgba(35, 138, 169, 0.6));
	background: -moz-linear-gradient(right, rgba(0, 251, 251, 0.6), rgba(35, 138, 169, 0.6));
	border-radius: 2px;
	text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

.text-wrap {
	color: #e6e6e6;
	overflow-x: hidden;
	padding-left: 30px;
	padding-right: 30px;
	font-family: 'Cormorant Infant', serif;
}

.quote-text {
	text-align: center;
	padding-top: 30px;
	font-weight: 400;
	font-size: 24px;
	padding-bottom: 43px;
}

.quote-author {
	position: absolute;
	bottom: 0;
	right: 0;
	margin-right: 17px;
	font-size: 20px;
	padding-bottom: 5px;
	letter-spacing: 1px;
}

#custom-quotation-mark {
	padding-right: 8px;
}

.button-row {
	position: absolute;
	margin-bottom: -83px;
}

#quote-button {
	left: 0;
	bottom: 0;
	/* comment out these two lines to rever to std colors */
	background: rgba(255, 255, 255, 0.3);
	border: 1px solid transparent;
}

#quote-button:hover {
	background: #fff;
	color: #1252a0 !important;
}

#post-twitter {
	right: 0;
	bottom: 0;
	background: #1da1f2;
	/* For browsers that do not support gradients */
	background: linear-gradient(#1da1f2, #096caa);
	background: -webkit-linear-gradient(#1da1f2, #096caa);
	background: -o-linear-gradient(#1da1f2, #096caa);
	background: -moz-linear-gradient(#1da1f2, #096caa);
}

#post-facebook {
	right: 67px;
	bottom: 0;
	background: #3b5998;
	/* For browsers that do not support gradients */
	background: linear-gradient(#4060a5, #324b81);
	background: -webkit-linear-gradient(#4060a5, #324b81);
	background: -o-linear-gradient(#4060a5, #324b81);
	background: -moz-linear-gradient(#4060a5, #324b81);
}


/* button customization */

.btn {
	/*box-shadow: 1px 1px 3px #b3b3b3; */
}

.btn.outline {
	background: none;
	padding: 9px 22px;
}

.btn-primary.outline {
	border: 1px solid #ccc;
	color: #fff;
}

.btn-primary.outline:hover {
	border-color: #fff;
	/*box-shadow: 1px 1px 3px #d9d9d9; */
}

.btn:focus,
.btn:active {
	outline: none;
	border-color: #ccc;
}

.btn-primary.outline:active,
.btn-primary.outline.active {
	outline: none;
	color: #fff;
	box-shadow: none;
	background: none;
}
              
            
!

JS

              
                $.getJSON("https://raw.githubusercontent.com/kevinkuehler/Web-Development/master/_assets/json/quotes.json", function(data) {
	/* 
		 gets one JSON object randomly
		 returns: JSON object (text,author)
	*/
	var jsonQuoteData; // holds current quote

	function getQuote() {
		return data[Math.floor(Math.random() * data.length)];
	}
	/* writes the code into HTML */
	function postNewQuote() {
		jsonQuoteData = getQuote();
		document.getElementById("quote").innerHTML = "<span id='custom-quotation-mark'><i class='fa fa-quote-left'> </i></span>" + jsonQuoteData.text;
		document.getElementById("author").innerHTML = "&#8212" + " " +
			jsonQuoteData.author;
	}

	/* on start */
	postNewQuote();

	/* buttons click */
	$("#quote-button").click(function() {
		postNewQuote();
	});

	$("#post-twitter").click(function() {
		centeredWindow("https://twitter.com/intent/tweet?text=" + jsonQuoteData.text + "%0A%E2%80%93" + jsonQuoteData.author, "Tweet this quote", '600', '320');
	});

	$("#post-facebook").click(function() {
		FB.ui({
			method: 'feed',
			name: "Random Quote Generator",
			link: 'https://codepen.io/kevinkuehler/full/bZREpr',
			description: jsonQuoteData.text,
			caption: "—" + jsonQuoteData.author,
		}, function(response) {});
	});
});

function centeredWindow(url, title, w, h) {
	var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left;
	var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top;

	var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
	var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;

	var left = ((width / 2) - (w / 2)) + dualScreenLeft;
	var top = ((height / 2) - (h / 2)) + dualScreenTop;
	var newWindow = window.open(url, title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);

	// Puts focus on the newWindow
	if (window.focus) {
		newWindow.focus();
	}
}
              
            
!
999px

Console