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.

            
              <div class="wrapper">
    <h1>Wee<strong>Grid</strong>.css</h1>

    <p>WeeGrid is a flexbox grid system <strong><em>Proof of Concept.</em></strong> Currently it works in chrome, Firefox Safari and Opera but neither IE or Edge support custom properties yet so it isn't production ready. <a href="http://caniuse.com/#feat=css-variables">Custom Property support</a></p>
    <p>WeeGrid needs a grid container <code>(.g)</code> which you can fill with Grid Items <code>.gi</code> By default grid items will span a full row and are controlled by the <code>--gi</code> variable.</p>
    
    <div class="g" style="--g-items: 6">
        <div class="gi" style="--gi: 6; --gi-m: 3; --gi-l: 2">
            <div class="content">1</div>
        </div>
        <div class="gi" style="--gi: 6; --gi-m: 1; --gi-l: 2">
            <div class="content">2</div>
        </div>
        <div class="gi" style="--gi: 6; --gi-m: 2; --gi-l: 2">
            <div class="content">3</div>
        </div>
        <div class="gi" style="--gi: 6; --gi-m: 2; --gi-l: 2">
            <div class="content">4</div>
        </div>
        <div class="gi" style="--gi: 6; --gi-m: 1">
            <div class="content">5</div>
        </div>
        <div class="gi" style="--gi: 6; --gi-m: 1">
            <div class="content">6</div>
        </div>
        <div class="gi" style="--gi: 6; --gi-m: 1">
            <div class="content">7</div>
        </div>
        <div class="gi" style="--gi: 6; --gi-m: 1">
            <div class="content">8</div>
        </div>
        <div class="gi" style="--gi: 6;">
            <div class="content">9</div>
        </div>
    </div>

    <h2>Setup</h2>

    <p>Create an element that will serve as the grid container. Give it a class of <code>.g</code>. To setup the number of grid columns and the gutter width add an <em>Inline style attribute</em> on the grid container and define the following variables: <code>--g-items</code> (total grid items per row) and <code>--g-gutter</code> (width of gutter, choose your own units!). e.g. <code>--g-items: 4; --g-gutter: 1rem</code></p>
    <p>Within the container add grid items which just need a class of <code>.gi</code>. You can add an inline style attribute to grid items to set the number of gridcolumns an item should span. e.g. <code>--gi: 4</code></p>
    
    <h2>Responsive</h2>
    <p>Wee Grid is fully responsive and as you can see in the css there are two breakpoints defined but really you can add as many as you like to make the grid work within your own development environment.</p>
    <p>Classes are inherited at larger breakpoints from smaller breakpoint definitions for example <code>--gi:4</code>. will span the element across 4 columns at all breakpoints unless a further variable value is set.</p>
    <p>To set differnt column spans there are additional variables to use: <code>--gi-m: (x)</code> for the medium breakpoint and <code>--gi-l: (x)</code> for the medium breakpoint</p>
</div>
    
            
          
!
            
              .g{
    --g-items: 12;
    --g-gutter: 1rem;
    display: flex;
    flex-wrap: wrap;
    margin-left: calc(var(--g-gutter) * -1);
}

.gi{
    --gi: 1;
    --gi-m: var(--gi); 
    --gi-l: var(--gi-m); 
    flex-basis: calc(100% / var(--g-items) * var(--gi));
    padding-left: var(--g-gutter);
    @media (min-width: 600px){ flex-basis: calc(100% / var(--g-items) * var(--gi-m)); }
    @media (min-width: 800px){flex-basis: calc(100% / var(--g-items) * var(--gi-l)); }
}













/**
 * Pretty styles (no effect on the grid)
 */

*{ margin: 0; padding: 0; box-sizing: border-box; }
@import url('https://fonts.googleapis.com/css?family=Muli:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i');
html{ font-family: 'muli', sans-serif; color: #112654; background-image: linear-gradient(-120deg,#f5f7fa,#fff); height: 100vh;}
h1,h2,p{ margin-bottom: 1rem; font-weight: 300; }
h1{ color: #e8198b; }
a,a:visited{ color: #e8198b; font-weight: bold; }
code{ background: #e8198b; border-radius: 2px; padding: 0 0.125rem;}
.wrapper { width: 80%; max-width: 900px; margin: 4rem auto; }
.content{ 
    background-image: linear-gradient(120deg, #e8198b, #c7eafd);
    background-attachment: fixed;
    padding: 1rem; 
    margin-bottom: 1rem;
    border-radius: 3px;
    text-align: center;
}

@media (min-width: 600px){
    h1, h2, a,a:visited{ color: #37c6ff; } 
    code{ background: #37c6ff;}
    .content{ background-image: linear-gradient(120deg, #37c6ff, #00f2fe); }
}

@media (min-width: 800px){
    h1,h2,a,a:visited{ color: #00e3ae;} 
    code{ background: #00e3ae;}
    .content{ background-image: linear-gradient(120deg, #00e3ae,#9be15d); }
}
            
          
!
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