Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

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

Details

Privacy

Go PRO Window blinds lowered to protect code. Code Editor with window blinds (raised) and a light blub turned on.

Keep it secret; keep it safe.

Private Pens are hidden everywhere on CodePen, except to you. You can still share them and other people can see them, they just can't find them through searching or browsing.

Upgrade to PRO

Behavior

Auto Save

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.

Template

Make Template?

Templates are Pens that can be used to start other Pens quickly from the create menu. The new Pen will copy all the code and settings from the template and make a new Pen (that is not a fork). You can view all of your templates, or learn more in the documentation.

Template URL

Any Pen can act as a template (even if you don't flip the toggle above) with a special URL you can use yourself or share with others. Here's this Pen's template URL:

Screenshot

Screenshot or Custom Thumbnail

Screenshots of Pens are shown in mobile browsers, RSS feeds, to users who chose images instead of iframes, and in social media sharing.

This Pen is using the default Screenshot, generated by CodePen. Upgrade to PRO to upload your own thumbnail that will be displayed on previews of this pen throughout the site and when sharing to social media.

Upgrade to PRO

HTML

              
                <h1>Flexbox grid with LESS ♥</h1>

<div class="grid-4">
		<div>1- lorem ipsum<br>Lorem Elsass ipsum lacus leverwurscht Wurschtsalad mamsell Gal.</div>
		<div>2- lorem ipsum Hopla choucroute !</div>
		<div>3- lorem ipsum<br>condimentum Verdammi ch'ai ac réchime météor barapli s'guelt quam, non Christkindelsmärik blottkopf, Carola tellus rucksack vielmols, Gal !</div>
		<div>4- lorem ipsum  lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum</div>
		<div class="flexitem-double flexitem-first">5- lorem<br>I have a <b>".flexitem-double"</b> and <b>".flexitem-first"</b> classes</div>
		<div>6- lorem ipsum<br>Lorem Elsass ipsum lacus leverwurscht Wurschtsalad mamsell Gal.</div>
		<div>7- lorem ipsum<br>Lorem Elsass ipsum lacus leverwurscht Wurschtsalad mamsell Gal.</div>
		<div>8- lorem ipsum<br>Lorem Elsass ipsum lacus leverwurscht Wurschtsalad mamsell Gal.</div>
		<div>9- lorem ipsum<br>Lorem Elsass ipsum lacus leverwurscht Wurschtsalad mamsell Gal.</div>
		<div style="margin-left: auto">10- lorem <br>I have a <code>margin-left: auto</code></div>
</div>

<h1>Flexbox uneven grids with LESS ♥</h1>

<h2>This is a "grid-3-1" class grid, but just change the class!</h2>

<div class="grid-3-1">
		<div>1- lorem ipsum<br>Lorem Elsass ipsum lacus leverwurscht Wurschtsalad mamsell Gal.</div>
		<div>2- lorem ipsum Hopla choucroute !</div>
		<div>3- lorem ipsum<br>condimentum Verdammi ch'ai ac réchime météor barapli s'guelt quam, non Christkindelsmärik blottkopf, Carola tellus rucksack vielmols, Gal !</div>
		<div>4- lorem ipsum  lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum</div>
		<div>5- lorem ipsum<br>Lorem Elsass ipsum lacus leverwurscht Wurschtsalad mamsell Gal.</div>
		<div>6- lorem ipsum<br>Lorem Elsass ipsum lacus leverwurscht Wurschtsalad mamsell Gal.</div>
		<div>7- lorem ipsum<br>Lorem Elsass ipsum lacus leverwurscht Wurschtsalad mamsell Gal.</div>
		<div>8- lorem ipsum<br>Lorem Elsass ipsum lacus leverwurscht Wurschtsalad mamsell Gal.</div>
		<div>9- lorem ipsum<br>Lorem Elsass ipsum lacus leverwurscht Wurschtsalad mamsell Gal.</div>
		<div>10- lorem aussi</div>
		<div>11- hopla</div>
</div>
              
            
!

CSS

              
                // WARNING : don't forget to prefix Flexbox for older browsers!

// config breakpoints (choose unit you prefer)
@tiny-screen			: 480px; // tiny screens media query (less than 480px)
@small-screen			: 768px; // screens between 481px and 768px
@medium-screen			: 1024px; // screens between 769px and 1024px
@large-screen			: 1280px; // screens between 1025px and 1280px

@gutter: 1em;
@number: 4; // for equal columns
@left: 2; // left side of uneven columns
@right: 1; // right side of uneven columns

// grid styles for container wich has a .grid(n,g) class
// n = number of columns (default = 4)
// g = gutter value (default = 1em)
// example : .grid-container { .grid(12, 10px); }

[class*="grid-"] {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	justify-content: space-between;
	margin-left: -@gutter;
}

[class*="grid-"] > * {
	flex: 0 0 auto;
	display: block; /* IE fix */
	width: ~'calc(100% * 1 / @{number} - @{gutter})';
	margin-left: @gutter;
}

 .grid(@number:@number, @gutter:@gutter) { 
 & > * {
	  width: ~'calc(100% * 1 / @{number} - @{gutter})';
	}
	& > .flexitem-double {
		width: ~'calc(100% * 2 / @{number} - @{gutter})';
	}
	& > .flexitem-first {
		order: -1;
	}
	@media (min-width: (@tiny-screen + 1)) and (max-width: @small-screen) {
		& > * {
			width: ~'calc(100% * 1 / 2 - @{gutter})';
		}
		& > .flexitem-double {
			width: ~'calc(100% - @{gutter})';
		}
	}
	@media (max-width: @tiny-screen) {
		& > * {
			width: ~'calc(100% - @{gutter})';
		}
		& > .flexitem-double {
			width: ~'calc(100% - @{gutter})';
		}
	}
}


/* examples */

.grid-2 {
	.grid(2);
}

.grid-3 {
	.grid(3);
}

.grid-4 {
	.grid(4);
}

.grid-5 {
	.grid(5);
}

.grid-6 {
	.grid(6);
}

.grid-7 {
	.grid(7);
}

.grid-8 {
	.grid(8);
}

.grid-10 {
	.grid(10);
}

.grid-12 {
	.grid(12);
}

.grid-16 {
	.grid(16);
}

// grid styles for container wich has a .uneven-grid(l,r,g) class
// left = left ratio column (default = 2)
// right = right ratio column (default = 1)
// gutter (default = 1em)
// example : .grid-container { .uneven-grid(2, 1, 10px); }
 .uneven-grid(@left:@left, @right:@right, @gutter:@gutter) { 
	& > *:nth-child(odd) {
		@size: (@left / (@left + @right)) * 100%;
		width: ~'calc(@{size} - @{gutter})';
	}
	& > *:nth-child(even) {
		@size: (@right / (@left + @right)) * 100%;
		width: ~'calc(@{size} - @{gutter})';
	}
	@media (max-width: @tiny-screen) {
		& > *:nth-child(n) {
			width: ~'calc(100% - @{gutter})';
		}
	}
}


/* examples */

.grid-2-1 {
	.uneven-grid(2,1);
}

.grid-1-2 {
	.uneven-grid(1,2);
}

.grid-3-1 {
	.uneven-grid(3,1);
}

.grid-1-3 {
	.uneven-grid(1,3);
}

.grid-3-2 {
	.uneven-grid(3,2);
}

.grid-2-3 {
	.uneven-grid(2,3);
}

.grid-4-1 {
	.uneven-grid(4,1);
}

.grid-1-4 {
	.uneven-grid(1,4);
}


/* deco */
* {
  box-sizing: border-box;
}
body {
  margin: 20px;  
  font-family: helvetica, arial, sans-serif;
	font-size: 1em;
}

[class*="grid-"] > div  {  
  margin-bottom: 20px; 
	padding: 1em;
	border: .25em dotted goldenrod;
  color: #fff; 
  background-color: olivedrab;
}
              
            
!

JS

              
                
              
            
!
999px
Learning 3D transforms in CSS requires a little perspective.

Console