octocatstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource
via CSS Lint

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource
via JS Hint

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Want a Run Button?

If active, the preview will update automatically when you change code.

HTML

            
              	<div class="flex-container">
		<header>
			<h1>Header</h1>
		</header>

		<div class="flex-area">
			
			<section>
				
				<article class='featured-article'>
					<h2>First Article</h2>
					<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent eget purus scelerisque nisi consectetur feugiat eget vel magna. Pellentesque eget mauris vitae dolor porta mattis. Vestibulum varius tincidunt tempus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent euismod tellus vel dolor mattis vehicula. Donec eget leo massa. Vivamus id felis quam, sodales feugiat sapien. Etiam in justo at metus dignissim laoreet non ac arcu. Nunc semper condimentum metus ut luctus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean orci tellus, elementum non porta quis, egestas id quam. Integer a mi in felis pulvinar aliquam interdum nec augue. Proin magna enim, bibendum ut molestie ut, adipiscing sit amet odio.</p>

					<p>Vivamus nec venenatis lacus. Donec lectus nisi, pellentesque sed facilisis eget, commodo sit amet risus. Nam purus nisi, sollicitudin eleifend lacinia aliquet, sollicitudin eget turpis. Nam pellentesque diam non turpis elementum at aliquet justo iaculis. Aliquam erat volutpat. Vestibulum accumsan vulputate pharetra. Fusce in diam nec neque varius aliquet et at sem.</p>
				</article>
					
				<article>
					<h2>Second Article</h2>
					<p>Vivamus nec venenatis lacus. Donec lectus nisi, pellentesque sed facilisis eget, commodo sit amet risus. Nam purus nisi, sollicitudin eleifend lacinia aliquet, sollicitudin eget turpis. Nam pellentesque diam non turpis elementum at aliquet justo iaculis. Aliquam erat volutpat. Vestibulum accumsan vulputate pharetra. Fusce in diam nec neque varius aliquet et at sem.</p>
				</article>
				
				<article>
					<h2>Third Article</h2>
					<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent eget purus scelerisque nisi consectetur feugiat eget vel magna. Pellentesque eget mauris vitae dolor porta mattis. Vestibulum varius tincidunt tempus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent euismod tellus vel dolor mattis vehicula. Donec eget leo massa. Vivamus id felis quam, sodales feugiat sapien. Etiam in justo at metus dignissim laoreet non ac arcu. Nunc semper condimentum metus ut luctus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean orci tellus, elementum non porta quis, egestas id quam. Integer a mi in felis pulvinar aliquam interdum nec augue. Proin magna enim, bibendum ut molestie ut, adipiscing sit amet odio.</p>
				</article>
			</section>

			<aside>
				<h1>Sidebar</h1>
				<div class="box"></div>
				<div class="box"></div>
				<div class="box"></div>
			</aside>

		</div>

		<footer>
			<h1>Footer</h1>
		</footer>

	</div>

            
          
!

CSS

            
              * {
	margin: 0;
	padding: 0;
	position: relative;
}

body {
	font-size: 100%;
	font-family: Trebuchet MS, sans-serif;
}

.flex-container {
	display: -webkit-flex;
	display: flex;
    -webkit-flex-flow: column;
            flex-flow: column;
}

header, footer {
	flex: 0 0 100px;
	-webkit-flex: 0 0 100px;
	    	
	background: #bbb;
	border-radius: 3px;
	border: solid 1px #222;
	
	margin: 4px;
	padding: 5px;
	
}

.flex-area {
	flex: 3 1 auto;
	-webkit-flex: 3 1 auto;
	    
	display: -webkit-flex;
	display: flex;
    -webkit-flex-flow: row;
            flex-flow: row;
	
	background: #bbb;
	border-radius: 3px;
	border: solid 1px #222;

	margin: 4px;
	padding: 5px;
}

section {
	display: -webkit-flex;
	display: flex;
    -webkit-flex-flow: row wrap;
            flex-flow: row wrap;
	-webkit-flex: 4 1 auto;	
			flex: 4 1 auto;
	
	background: #ffb;
	border-radius: 3px;
	border: solid 1px #222;	
	
	margin: 4px;
	padding: 5px;

}

article {
	flex: 1 35%;
	-webkit-flex: 1 35%;

	background: #fbb;
	border-radius: 3px;
	border: solid 1px #222;	
	
	margin: 4px;
	padding: 5px;
	
}

.featured-article {
	flex: 2 1 100%;
	-webkit-flex: 2 1 100%;

}

aside {
	flex: 0 0 240px;
	-webkit-flex: 0 0 240px;
	    
	display: -webkit-flex;
	display: flex;
    -webkit-flex-flow: column;
            flex-flow: column;   
	    
	background: #ffb;
	border-radius: 3px;
	border: solid 1px #222;	

	margin: 4px;
	padding: 5px;
}

.box {
	flex: 1;
	-webkit-flex: 1;
	    
	background: #fbb;
	border-radius: 3px;
	border: solid 1px #222;
	
	margin: 4px;
	padding: 5px;
}

@media only screen and (max-width: 640px) {
	.flex-area {
		-webkit-flex-flow: column;
    	flex-flow: column;
	}

	header, footer, aside {
		-webkit-flex: 0 0 50px;
		flex: 0 0 50px;
	}

	aside {
		-webkit-order: 1;
		order: 1;
	    
	    flex-flow: row;
	    -webkit-flex-flow: row;		    
	}

	section {
		-webkit-order: 2;
		order: 2;
	}
}

@media only screen and (max-width: 420px) {
	section {
		-webkit-flex-flow: column;
		flex-flow: column;
	}

	article {
		flex: 1;
		-webkit-flex: 1;	
	}

	aside h1 {
		position: absolute;
		top: 5px;
		left: 5px;
		z-index: 2;
	}
}
            
          
!

JS

            
              
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console