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

              
                <ul class="d-flex d-ex5">
								<li>
									Flex shrink: 1,<br />
									Flex basis: 200px
								</li>
								<li>
									Flex Shrink: 2,<br />
									Flex basis: 200px
				
								</li>
								<li>
									Flex Shrink: 3,<br />
									Flex basis: 200px
									
								</li>
								<li>
									Flex Shrink 1,<br />
									Flex basis: 200px
								</li>


							</ul>
              
            
!

CSS

              
                //stylesheet for flexbox navigation

.d-flexbox-navigation {
  
	background:#484281;
	border:1px solid #111;
	padding:1em;

}
.d-flexbox-navigation ul {
	
	display:flex;
	flex:1 1 20%;

	flex-direction:row;
	align-items:center;
	justify-content:center;
	transition:all 0.4s ease-in-out;

}
.d-flexbox-navigation li {
	
	display:flex;
	flex:1 1 20%;
	align-items:center;
	justify-content:flex-start;
	transition:all 0.4s ease-in-out;
	
}
.d-flexbox-navigation li a {

	border:1px solid #111;
	padding:1.5em;
	display:block;
	background:#fff;
	border-radius:3px;
	text-decoration:none;
	text-align:center;
	color: #333;
	width:100%;
	transition:all 0.4s ease-in-out;

	&:hover {
		
		background:#a303cb;
		color:#fff;
	}

}

.d-flex {

	display:flex;
	margin:0 auto;
	box-sizing:border-box;
	align-items:stretch;
}
.d-flex li {

	color:#fff;
	display:flex;
	list-style:none;
	justify-content:center;
	align-items:center;
	padding:1em;
}
.d-flex li:nth-of-type(1){

	background:#484281;

}
.d-flex li:nth-of-type(2){

	background:#5248af;

}
.d-flex li:nth-of-type(3){

	background:#786bfa;

}
.d-flex li:nth-of-type(4){

	background:#aba3f9;

}
.d-flex li:nth-of-type(5){
	background:#a303cb;
}


.d-ex1 {

	max-width:600px;

}

.d-ex2 {

	max-width:600px;

}

.d-ex3 {

	max-width:1000px;

}
.d-ex4 {

	max-width:1000px;

}
.d-ex5 {

	max-width:600px;

}
.d-ex6 {
	max-width:600px;
}

// example 1

.d-ex1 li:nth-of-type(1) { 

	flex:2 0 100px;
}


.d-ex1 li:nth-of-type(2) {

	flex:0 0 150px;

}

.d-ex1 li:nth-of-type(3) {

	flex:2 0 100px;
	
}


//example 2

.d-ex2 li:nth-of-type(1){

	flex:2 0 150px;

}
.d-ex2 li:nth-of-type(2){


	flex:0 0 150px;

}
.d-ex2 li:nth-of-type(3){

	flex:2 0 100px;
}

// example 3

.d-ex3 li:nth-of-type(1) {

	flex:3 0 0;

}
.d-ex3 li:nth-of-type(2) {

	flex: 1 0 0;

}
.d-ex3 li:nth-of-type(3){
	
	flex:2 0 0;
}

//example 4

.d-ex4 li:nth-of-type(1){

	flex:1 0 150px;

}
.d-ex4 li:nth-of-type(2){

	flex:3 0 200px;

}
.d-ex4 li:nth-of-type(3){

	flex:2 0 175px;
}
.d-ex4 li:nth-of-type(4){

	flex:4 0 225px;

}

//example 5

.d-ex5 li:nth-of-type(1){

	flex:1 1 200px;

}
.d-ex5 li:nth-of-type(2){
	
	flex:3 2 200px;

}
.d-ex5 li:nth-of-type(3){

	flex:2 3 200px;

}
.d-ex5 li:nth-of-type(4){

	flex:4 1 200px;


}

//example 6

.d-ex6 li:nth-of-type(1){

	flex:1 1 150px;

}
.d-ex6 li:nth-of-type(2){
	
	flex:3 2 400px;

}
.d-ex6 li:nth-of-type(3){

	flex:2 3 400px;

}
.d-ex6 li:nth-of-type(4){

	flex:4 0 200px;


}




.is-removing {

	animation: flexRemove 0.5s 0.5s ease forwards 1;

}

.is-adding {

	animation: flexInsert 0.5s 0.5s ease forwards 1;

}

@keyframes flexInsert {

	0% {

		transform:scale(0);

	}
	70% {

		transform:scale(1.05);

	}
	80% {
		transform:scale(0.95);
	}

	100% {
		transform:scale(1)

	}
}

@keyframes flexRemove {

	0% {

		transform:scale(1);

	}
	

	100% {
		transform:scale(0)

	}
}
              
            
!

JS

              
                //200/1
//200/2
//200/3
//200/1
//limit is 600
//200 over

//1/7 * 200
//28.57
//200 - 28.57 = 171.43
//Actual result: 186
              
            
!
999px

Console