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

              
                <main class="main" role="main">
	<div class="intro">
		<h1>Welcome to my website!</h1>
		
		<p>This page demonstrates how to use <a href="https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Flexible_boxes">flexbox</a> in a progressively-enhanced fashion by making slight alterations to the layout depending on the available viewport width.</p>
		<p>For viewports wider than roughly 900 pixels and in browsers with flexbox support, the "Buy this thing!" advertisement should appear at the top of the page, above this introductory content.</p>
	</div>
	
	<div class="social">
		<h2>Social Links</h2>
		
		<ul>
			<li><a href="https://codepen.io/jgarber" rel="me">CodePen</a></li>
			<li><a href="http://flickr.com/photos/jgarber" rel="me">Flickr</a></li>
			<li><a href="http://instagram.com/jgarber" rel="me">Instagram</a></li>
			<li><a href="https://twitter.com/jgarber" rel="me">Twitter</a></li>
		</ul>
	</div>
	
	<aside class="advert" role="complementary">
		<h2>Buy this thing!</h2>
		
		<figure>
			<div class="book-cover">
				<img src="https://f.cl.ly/items/3n3i021R2H2F1l1p3G0f/foundation-html5-with-css3.jpg" alt="Foundation HTML5 with CSS3 book cover">
			</div>
			<figcaption>
				<p>For those new to web development and seasoned pros alike, <cite>Foundation HTML5 with CSS3: A Modern Guide and Reference</cite> uses practical examples that teach readers how to correctly use semantic, standards-compliant HTML5 and CSS3.</p>
				<a href="http://www.amazon.com/dp/1430238763/?tag=sixtwothree-20" class="button">Buy on Amazon</a>
			</figcaption>
		</figure>
	</aside>
</main>
              
            
!

CSS

              
                *,
*:before,
*:after {
	box-sizing: inherit;
}

html {
	box-sizing: border-box;
}

body {
	background: #faebd0;
	font: normal 1.125em/1.7 Georgia, serif;
	margin: 0;
	padding: 1em;
}

h1,
h2 {
	font-weight: normal;
	line-height: 1.1;
}

h1 {
	font-size: 2em;
	margin: 1em 0;
}

h2 {
	font-size: 1.66em;
	margin: 1em 0;
}

p {
	margin: 1.5em 0;
}

a {
  color: #c00;
}

.main {
	margin: 0 auto;
	max-width: 40em;
}

.advert figure {
	background: rgba(#000, 0.1);
	margin: 0;
	padding: 1em;
}

.book-cover img {
	display: block;
	max-width: 100%;
}

.button {
	background: rgba(#000, 0.1);
	border-radius: 0.25em;
	display: block;
	padding: 0.5em 1em;
	text-align: center;
}

.button:focus,
.button:hover {
	background: rgba(#000, 0.15);
}

@media (min-width: 30em) {
	.advert figure {
		display: -ms-flexbox;
		display: -webkit-flex;
		display: flex;
	}
	
	.book-cover {
		width: 30%;
	}
	
	.advert figcaption {
		padding-left: 1em;
		width: 70%;
	}
	
	.advert figcaption > :first-child {
		margin-top: 0;
	}
}

@media (min-width: 50em) {
	.main {
		display: -ms-flexbox;
		display: -webkit-flex;
		display: flex;
		-ms-flex-direction: column;
		-webkit-flex-direction: column;
		flex-direction: column;
	}
	
	.intro,
	.social {
		-ms-flex-order: 1;
		-webkit-order: 1;
		order: 1;
	}
	
	.advert {
		-ms-flex-order: 0;
		-webkit-order: 0;
		order: 0;
	}
}
              
            
!

JS

              
                
              
            
!
999px

Console