css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <h1>Grillade : KNACSS v6 grid system</h1>
<p class="txtcenter"><i>Should</i> work on IE10, IE11, Edge, Chrome, Firefox, Safari 8+, Android 4.4+. See <a href="http://grillade.knacss.com">grillade.knacss.com</a> (french)</p>
<p class="txtcenter"><b>Note:</b> on tiny screens (smartphones), all grids should be displayed within 1 unique column.</p>

<h2>the .grid object</h2>
<p><code>.grid</code> is meant for <b>one line display</b>. <br>Add any number of children and they will all be automagically inlined and have same size</p>
<section class="grid">
	<div>just a div, no class</div>
	<div>yay, me too</div>
	<aside>hi there, I'm a &lt;aside&gt;!</aside>
</section>

<h2>adding gutters: .grid.has-gutter</h2>
<p>add a <code>.has-gutter</code> class when you need gutter between children</p>
<section class="grid has-gutter">
	<div>Lorem Elsass ipsum Choucroute knack</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass ipsum Choucroute</div>
</section>

<h2>sizing gutters</h2>
<p>add a <code>.has-gutter-l</code> or <code>.has-gutter-xl</code> class to change gutter size</p>
<section class="grid has-gutter-xl">
	<div>Lorem Elsass ipsum Choucroute knack</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass ipsum Choucroute</div>
</section>

<h2>.grid and children sizing</h2>
<p>children can be individually sized with classes such as <code>.one-half</code>, <code>.one-third</code>, <code>.one-quarter</code>, <code>.one-fifth</code>, <code>.two-thirds</code>, <code>.three-quarters</code>, <code>.one-sixth</code>, <code>.five-sixths</code>, or <code>.full</code></p>
<section class="grid">
	<div class="one-fifth">.one-fifth</div>
	<div>Lorem Elsass ipsum</div>
</section>

<h2>.grid.has-gutter and children sizing</h2>
<p>works also with <code>.has-gutter</code> class</p>
<section class="grid has-gutter">
	<div class="one-fifth">.one-fifth</div>
	<div>Lorem Elsass ipsum</div>
	<div class="one-fifth">.one-fifth</div>
</section>

<h2>.grid-3</h2>
<p>add a number suffix to <code>.grid</code> such as <code>-3</code> to switch into <b>multi-lines display</b> (from 1 to 12)</p>
<section class="grid-3">
	<div>Lorem Elsass ipsum Choucroute knack</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass ipsum Choucroute</div>
	<div>Lorem Elsass ipsum Choucroute knack</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass ipsum Choucroute</div>
	<div>Lorem Elsass ipsum Choucroute knack</div>
	<div>Lorem Elsass</div>
</section>

<h2>.grid-3.has-gutter</h2>
<p>works also with <code>.has-gutter</code> class</p>
<section class="grid-3 has-gutter">
	<div>Lorem Elsass ipsum Choucroute knack</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass ipsum Choucroute</div>
	<div>Lorem Elsass ipsum Choucroute knack</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass ipsum Choucroute</div>
	<div>Lorem Elsass ipsum Choucroute knack</div>
	<div>Lorem Elsass</div>
</section>

<h2>.grid-3</h2>
<p>works also with sized children</p>
<section class="grid-3">
	<div>Lorem Elsass ipsum Choucroute knack</div>
	<div>Lorem Elsass ipsum Choucroute knack</div>
	<div>Lorem Elsass ipsum Choucroute knack</div>
	<div class="one-half">.one-half</div>
	<div class="one-half">.one-half</div>
	<div class="one-third">.one-third</div>
	<div class="two-thirds">.two-thirds</div>	
	<div class="full">.full</div>
	<div class="one-quarter">.one-quarter</div>
	<div class="one-quarter">.one-quarter</div>
	<div class="one-half">.one-half</div>
</section>

<h2>push / pull element</h2>
<p>add <code>.push</code> or <code>.pull</code> class to create offsets</p>
<section class="grid-4">
	<div>Lorem Elsass ipsum Choucroute knack</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass ipsum Choucroute</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass</div>
	<div class="push">.push</div>
	<div>Lorem Elsass</div>
</section>

<h2>first / last element</h2>
<p>add <code>.grid-item-first</code> or <code>.grid-item-last</code> class to reorder elements</p>
<section class="grid-4">
	<div>Lorem Elsass ipsum Choucroute knack</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass ipsum Choucroute</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass</div>
	<div class="grid-item-first">.grid-item-first</div>
	<div>Lorem Elsass</div>
</section>

<h2>reverse order: </h2>
<p>add <code>--reverse</code> suffix on grid container to reverse the whole grid</p>
<section class="grid-3--reverse-small-2">
	<div>one</div>
	<div>two</div>
	<div>three</div>
	<div>four</div>
	<div>five</div>
	<div>six</div>
	<div>seven</div>
</section>

<h2>.grid-3-small-2</h2>
<p>add <code>-small-X</code> (X from 1 to 4) suffix to define column numbers on small screens, here will be 2 columns. <i>Note : on tiny screens, value is always 1 column</i></p>
<section class="grid-3-small-2">
	<div>Lorem Elsass ipsum Choucroute knack</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass ipsum Choucroute</div>
	<div>Lorem Elsass ipsum Choucroute knack</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass ipsum Choucroute</div>
	<div class="one-half">.one-half</div>
	<div class="one-half">.one-half</div>
	<div class="one-third">.one-third</div>
	<div class="two-thirds">.two-thirds</div>	
	<div class="full">.full</div>
	<div class="one-quarter">.one-quarter</div>
	<div class="one-quarter">.one-quarter</div>
	<div class="one-half">.one-half</div>
</section>

<h2>.grid-4-small-3</h2>
<section class="grid-4-small-3">
	<div>Lorem Elsass ipsum Choucroute knack</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass ipsum Choucroute</div>
	<div>Lorem Elsass ipsum Choucroute knack</div>
	<div>Lorem Elsass</div>
</section>

<h2>.grid-6-small-4</h2>
<section class="grid-6-small-4">
	<div>Lorem Elsass ipsum Choucroute knack</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass ipsum Choucroute</div>
	<div>Lorem Elsass ipsum Choucroute knack</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass</div>
</section>

<h2>.grid-3-small-2.has-gutter</h2>
<p>works also with <code>.has-gutter</code> class</p>
<section class="grid-3-small-2 has-gutter">
	<div>Lorem Elsass ipsum Choucroute knack</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass ipsum Choucroute</div>
	<div>Lorem Elsass ipsum Choucroute knack</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass ipsum Choucroute</div>
	<div class="one-half">.one-half</div>
	<div class="one-half">.one-half</div>
	<div class="one-third">.one-third</div>
	<div class="two-thirds">.two-thirds</div>	
	<div class="full">.full</div>
	<div class="one-quarter">.one-quarter</div>
	<div class="one-quarter">.one-quarter</div>
	<div class="one-half">.one-half</div>
</section>

<h2>Sass mixin</h2>
<p>you can design your own Sass mixin. Here : <code>.grid-sans-gouttiere { @include grid(4, 0); }</code></p>
<section class="grid-sans-gouttiere">
	<div>Lorem Elsass ipsum Choucroute knack</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass ipsum Choucroute</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass</div>
</section>

<h2>Sass mixin and gutter</h2>
<p>works also. Here : <code>.grid-perso { @include grid(4, 2rem); }</code></p>
<section class="grid-perso">
	<div>Lorem Elsass ipsum Choucroute knack</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass ipsum Choucroute</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass</div>
	<div>Lorem Elsass</div>
</section>
            
          
!
            
              // Responsive breakpoints variables

// Warning : you should use your own values, 
// regardless of the devices
// Best practise : (max-width: $BP) and (min-width: ($BP + 1))
$tiny: 543px !default; // or 'em' if you prefer, of course
$small: 767px !default;
$medium: 991px !default;
$large: 1199px !default;
$extra-large: 1439px !default;

// gutter values for grid layouts. Unit can be: %, px, em, rem
$grid-gutters: (
  '': 1rem,
  '-l': 2rem,
  '-xl': 4rem
);
// IEfixing, see 
// https://github.com/alsacreations/KNACSS/issues/133;
$iefix: .01px; 
@media (min-width: ($tiny + 1)) {
  [class*=" grid-"],
  [class^="grid-"] {
		display: flex;
  	flex-direction: row;
  	flex-wrap: wrap;
		
    & > * {
      box-sizing: border-box;
      min-width: 0;
      min-height: 0; 
    }
	}
}

// Multi-line grid constructor
// example : .grid-perso { @include grid(12, 3rem); }
@mixin grid($grid-number:1, $own-gutter:0) {
  & > * {
		width: calc(100% / #{$grid-number} - #{$iefix});
  }
	@each $affix, $size in $grid-gutters {
		&.has-gutter#{$affix} {
			margin-right: -$size / 2;
			margin-left: -$size / 2;

			& > * {
				width: calc(100% / #{$grid-number} - #{$size} - #{$iefix});
				margin-right: $size / 2;
				margin-left: $size / 2;
			}
		}
	}
  @if ($own-gutter != 0) { 
    margin-right: -$own-gutter / 2;
    margin-left: -$own-gutter / 2;

    & > * {
			width: calc(100% / #{$grid-number} - #{$own-gutter} - #{$iefix});
      margin-right: $own-gutter / 2;
      margin-left: $own-gutter / 2;
    }
  }
}

// Mono-line grid constructor (.grid)
@media (min-width: ($tiny + 1)) {
  .grid {
    display: flex;

    & > * {
      flex: 1 1 0%;
			box-sizing: border-box;
      min-width: 0;
      min-height: 0;
    }
		@each $affix, $size in $grid-gutters {
			&.has-gutter#{$affix} > * + * {
				margin-left: calc(#{$size} - #{$iefix});
			}
		}
  }
}

// Constructing grids : will be compiled in CSS
@media (min-width: ($tiny + 1)) {
   @for $i from 2 through 12{
    [class*="grid-#{$i}"] {
      @include grid(#{$i},0);
    }
  }
}

// Grid offsets
.push {
  margin-left: auto !important;
}

.pull {
  margin-right: auto !important;
}
/* Grid order */
.grid-item-first {
  order: -1;
}

.grid-item-last {
  order: 1;
}

[class*="--reverse"] {
  flex-direction: row-reverse;
}

// sizing individual children
@media (min-width: ($tiny + 1)) {
@each $flow, $divider in ("full" "1"), 
                          ("one-half" "2"),
                          ("one-third" "3"),
                          ("one-quarter" "4"),
                          ("one-fifth" "5"),
                          ("one-sixth" "6"),
                          ("two-thirds" "3 * 2"),
                          ("three-quarters" "4 * 3"),
                          ("five-sixths" "6 * 5")
  	{
    .#{$flow} {
      flex: 0 0 auto;
      width: calc(100% / #{$divider} - #{$iefix});
		} 
    @each $affix, $size in $grid-gutters {
			.has-gutter#{$affix} .#{$flow} {
        width: calc(100% / #{$divider} - #{$size} - #{$iefix});
        }
     }
  }
}

/* Responsive Small Breakpoint */
// -small-X suffix means "X columns on small screen"
// example : .grid-4-small-2 will be 1 column (tiny and down) then 2 columns (until small) then 4 columns
@media (min-width: ($tiny + 1)) and (max-width: $small) {
  @for $i from 1 through 4 {
    [class*="-small-#{$i}"] {
      & > * {
        width: calc(100% / #{$i} - #{$iefix});
      }
      @each $affix, $size in $grid-gutters {
        &.has-gutter#{$affix} > * {
          width: calc(100% / #{$i} - #{$size} - #{$iefix});
        }
      }
    }
  }
}




.grid-sans-gouttiere { 
	@media (min-width: $tiny + 1) {
		@include grid(3, 0); 
	}
}

.grid-perso { 
	@media (min-width: $tiny + 1) {
		@include grid(4, 2rem); 
	}
}






/* deco */
html {
	font-size: 62.5%;
}
body {
	margin: 2rem; 
	padding: 1rem 0;
	font-family: arial, sans;
	font-size: 1.6em;
}

[class*="grid"] > *  {
	padding: .5em;
  background: olivedrab;
  margin-bottom: 1rem;
	color: #fff;
	outline: 1px dotted #fff;
}
h1 {
	margin: 0 0 1em;
	color: #345;
	text-align: center;
  font-family: georgia, "trebuchet ms", arial, serif;
}
h2 {
  display: inline-block;
	margin: 3rem 0 .6rem;
	color: #567;
  font-family: georgia, "trebuchet ms", arial, serif;
}
p {margin-top: 0;}
.txtcenter {
	text-align: center;
}
code {
	font-size: 130%;
	color: firebrick;
}

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console