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="grid">
    <div class="grid__item grid__item1">
        <div class="card ">
            <div class="bg--primary">
                <p class="h2">Nostra dis enim per sit integer maecenas litora, metus massa vel volutpat vulputate pharetra, curabitur penatibus montes sodales leo ut.</p>
            </div>
        </div>
    </div>
    <div class="grid__item grid__item2">
        <div class="card">
            <div>
                <img src="https://placeimg.com/480/480/nature" />
            </div>
        </div>
    </div>

    <div class="grid__item grid__item3">
        <div class="card">
            <div class="bg--neutral--darker">
                <p>Faucibus litora elementum ut neque penatibus curabitur ridiculus.</p>
            </div>
        </div>
    </div>
    <div class="grid__item grid__item4">
        <div class="card">
            <div>
                <img src="https://placeimg.com/480/480/nature?v3" />
            </div>
        </div>
    </div>
    <div class="grid__item grid__item5">
        <div class="card">
            <div class="bg--neutral--dark">
                <p>Risus cursus auctor adipiscing accumsan.</p>
            </div>
        </div>
    </div>
    <div class="grid__item grid__item6">
        <div class="card">
            <div class="bg--neutral--darker">
                <p>Aliquam fringilla congue at quam nec cursus.</p>
            </div>
        </div>
    </div>
    <div class="grid__item grid__item7">
        <div class="card">
            <div>
                <img src="https://placeimg.com/480/480/nature?v4" />
            </div>
        </div>
    </div>
    <div class="grid__item grid__item8">
        <div class="card">
            <div>
                <img src="https://placeimg.com/480/480/nature?v5" />
            </div>
        </div>
    </div>
    <div class="grid__item grid__item9">
        <div class="card">
            <div class="bg--neutral">
                <p>Quis ligula duis turpis phasellus est tortor euismod nam malesuada massa sem litora.</p>
            </div>
        </div>
    </div>
    <div class="grid__item grid__item10">
        <div class="card">
            <div>
                <img src="https://placeimg.com/480/480/nature?v6" />
            </div>
        </div>
    </div>
    <div class="grid__item grid__item11">
        <div class="card">
            <div class="bg--neutral--dark">
                <p>Hac imperdiet turpis curae nec magna tortor.</p>
            </div>
        </div>
    </div>

</div>
            
          
!
            
              @mixin grid-child($col-start, $col-end, $row-start, $row-end) {
    -ms-grid-column: $col-start;
    -ms-grid-column-span: $col-end - $col-start;
    -ms-grid-row: $row-start;
    -ms-grid-row-span: $row-end - $row-start;
    grid-column: #{$col-start}/#{$col-end};
    grid-row: #{$row-start}/#{$row-end};
    display: block;
}

$breakpoints: (
    min: 280,
    xs: 360,
    s: 480,
    m: 504,
    l: 800,
    xl: 960,
    xxl: 1280
);

$breakpoints-queries: ();

@function em($pixels, $context) {
    @return #{$pixels/$context}em;
}

@each $key, $pixels in $breakpoints {
    $screen-string: "only screen";

    @if ($pixels == "0") {
        $breakpoints-queries: map-merge(
            $breakpoints-queries,
            ($key: "#{$screen-string}")
        );
    } @else {
        $breakpoints-queries: map-merge(
            $breakpoints-queries,
            ($key: "#{$screen-string} and (min-width: #{em($pixels, 16)})")
        );
    }
}

@mixin breakpoint($media) {
    @if map-has-key($breakpoints-queries, $media) {
        @media #{map-get($breakpoints-queries, $media)} {
            @content;
        }
    } @else {
        @error "The breakpoint you have provided `#{$media}` is not defined in $breakpoints-queries";
    }
}

@mixin bp($media) {
    @include breakpoint($media) {
        @content;
    }
}

img {
  max-width: 100%;
  height: auto;
}

.bg--primary {
  background-color: #008000; }
.bg--neutral--dark {
  background-color: #767676; }
.bg--neutral--darker {
  background-color: #353535; }
.bg--neutral {
  background-color: #778; }
h2 {
  font-size: 2em;
}

p {
  margin: 0;
	font-family: "Helvetica Neue";
  line-height: 1.5;
}
.grid {
    margin: -0.5em;
    @include bp(xs) {
        display: grid;
        // 2 x 12 grid items = 24
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
    }
    @include bp(m) {
        // 3 x 8 grid items
        grid-template-columns: 1fr 1fr 1fr;
        grid-template-rows: 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
    }
    @include bp(l) {
        // 4 x 6 grid items
        grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
        grid-template-rows: 1fr 1fr 1fr;
    }
}

.grid__item {
    @include grid-child(1, 2, 1, 2);
}
.grid__item1 {
    @include bp(xs) {
        @include grid-child(1, 3, 1, 3);
    }
    @include bp(m) {
        @include grid-child(2, 4, 1, 3);
    }
}

.grid__item2 {
    @include bp(xs) {
        @include grid-child(1, 2, 3, 4);
    }
    @include bp(m) {
        @include grid-child(1, 2, 1, 2);
    }
}

.grid__item3 {
    @include bp(xs) {
        @include grid-child(2, 3, 3, 4);
    }
    @include bp(m) {
        @include grid-child(1, 2, 2, 3);
    }
}

.grid__item4 {
    @include bp(xs) {
        @include grid-child(1, 2, 4, 5);
    }
    @include bp(m) {
        @include grid-child(1, 2, 3, 4);
    }
    @include bp(l) {
        @include grid-child(4, 5, 1, 2);
    }
}

.grid__item5 {
    @include bp(xs) {
        @include grid-child(2, 3, 4, 5);
    }
    @include bp(m) {
        @include grid-child(2, 3, 3, 4);
    }
    @include bp(l) {
        @include grid-child(5, 6, 1, 2);
    }
}

.grid__item6 {
    @include bp(xs) {
        @include grid-child(1, 2, 5, 6);
    }
    @include bp(m) {
        @include grid-child(3, 4, 3, 4);
    }
    @include bp(l) {
        @include grid-child(4, 5, 2, 3);
    }
}

.grid__item7 {
    @include bp(xs) {
        @include grid-child(2, 3, 5, 6);
    }
    @include bp(m) {
        @include grid-child(1, 2, 4, 5);
    }
    @include bp(l) {
        @include grid-child(5, 6, 2, 3);
    }
}

.grid__item8 {
    @include bp(xs) {
        @include grid-child(1, 2, 6, 7);
    }
    @include bp(m) {
        @include grid-child(2, 3, 4, 5);
    }
    @include bp(l) {
        @include grid-child(1, 2, 3, 4);
    }
}
.grid__item9 {
    @include bp(xs) {
        @include grid-child(2, 3, 6, 7);
    }
    @include bp(m) {
        @include grid-child(3, 4, 4, 5);
    }
    @include bp(l) {
        @include grid-child(2, 3, 3, 4);
    }
}
.grid__item10 {
    @include bp(xs) {
        @include grid-child(1, 2, 5, 6);
    }
    @include bp(l) {
        @include grid-child(3, 4, 3, 4);
    }
}
.grid__item11 {
    @include bp(xs) {
        @include grid-child(2, 3, 5, 6);
    }
    @include bp(l) {
        @include grid-child(4, 5, 3, 4);
    }
}

.card {
    position: relative;
    height: 0;
    padding-top: 100%;
    > div {
        color: white;
        position: absolute;
        top: 0.5em;
        right: 0.5em;
        bottom: 0.5em;
        left: 0.5em;
    }
    p {
        padding: 1rem;
        font-weight: 300;
    }
}

            
          
!
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