cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              
    <div class="main">
        <div class="header">
            <h1>Layout for all</h1>
            <h2>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sunt, ipsa quisquam quasi veniam ex reiciendis veritatis itaque, fuga dolore, obcaecati aut velit in eligendi, suscipit vitae! Fugiat officia nesciunt tempore!</h2>
        </div>
        <div class="nav">
            <ul>
                <li><a href="#">link</a></li>
                <li><a href="#">link</a></li>
                <li><a href="#">link</a></li>
                <li><a href="#">link</a></li>
                <li><a href="#">link</a></li>
            </ul>
        </div class="nav">
        <div class="articles">
            <div class="article">
                <div class="img-wrap">
                    <img src="http://via.placeholder.com/350x150" alt="">
                </div>
                <h3>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eos, dolores modi consectetur deserunt excepturi fugit architecto, ex odio obcaecati placeat cumque officiis et, repellat similique, ipsam corporis? Neque, accusamus, fugiat!</h3>
                <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quod sapiente voluptates dolores dolorem qui porro dolor inventore earum excepturi fugit ratione labore et possimus, repellendus aspernatur temporibus explicabo. Ab, quia.</p>
                <p>Suscipit ipsam cupiditate voluptatem labore, impedit nulla perspiciatis consectetur</p>
            </div>
            <div class="article">
                <div class="img-wrap">
                    <img src="http://via.placeholder.com/350x150" alt="">
                </div>
                <h3>Suscipit ipsam cupiditate voluptatem labore, impedit nulla perspiciatis consectetur</h3>
                <p>Suscipit ipsam cupiditate voluptatem labore, impedit nulla perspiciatis consectetur</p>
            </div>
            <div class="article">
                <div class="img-wrap">
                    <img src="http://via.placeholder.com/350x150" alt="">
                </div>
                <h3>Suscipit ipsam cupiditate voluptatem labore, impedit nulla perspiciatis consectetur</h3>
                <p>Suscipit ipsam cupiditate voluptatem labore, impedit nulla perspiciatis consectetur</p>
            </div>
            <div class="article">
                <div class="img-wrap">
                    <img src="http://via.placeholder.com/350x150" alt="">
                </div>
                <h3>Suscipit ipsam cupiditate voluptatem labore, impedit nulla perspiciatis consectetur</h3>
                <p>Suscipit ipsam cupiditate voluptatem labore, impedit nulla perspiciatis consectetur</p>
            </div>
            <div class="article">
                <div class="img-wrap">
                    <img src="http://via.placeholder.com/350x150" alt="">
                </div>
                <h3>Suscipit ipsam cupiditate voluptatem labore, impedit nulla perspiciatis consectetur</h3>
                <p>Suscipit ipsam cupiditate voluptatem labore, impedit nulla perspiciatis consectetur</p>
                <p>Suscipit ipsam cupiditate voluptatem labore, impedit nulla perspiciatis consectetur</p>
                <p>Suscipit ipsam cupiditate voluptatem labore, impedit nulla perspiciatis consectetur</p>
            </div>
            <div class="article">
                <div class="img-wrap">
                    <img src="http://via.placeholder.com/350x150" alt="">
                </div>
                <h3>Suscipit ipsam cupiditate voluptatem labore, impedit nulla perspiciatis consectetur</h3>
                <p>Suscipit ipsam cupiditate voluptatem labore, impedit nulla perspiciatis consectetur</p>
            </div>
            <div class="article">
                <div class="img-wrap">
                    <img src="http://via.placeholder.com/350x150" alt="">
                </div>
                <h3>Suscipit ipsam cupiditate voluptatem labore, impedit nulla perspiciatis consectetur</h3>
                <p>Suscipit ipsam cupiditate voluptatem labore, impedit nulla perspiciatis consectetur</p>
            </div>
            <div class="article">
                <div class="img-wrap">
                    <img src="http://via.placeholder.com/350x150" alt="">
                </div>
                <h3>Suscipit ipsam cupiditate voluptatem labore, impedit nulla perspiciatis consectetur</h3>
                <p>Suscipit ipsam cupiditate voluptatem labore, impedit nulla perspiciatis consectetur</p>
            </div>
            <div class="article">
                <div class="img-wrap">
                    <img src="http://via.placeholder.com/350x150" alt="">
                </div>
                <h3>Suscipit ipsam cupiditate voluptatem labore, impedit nulla perspiciatis consectetur</h3>
                <p>Suscipit ipsam cupiditate voluptatem labore, impedit nulla perspiciatis consectetur</p>
            </div>
            <div class="article">
                <div class="img-wrap">
                    <img src="http://via.placeholder.com/350x150" alt="">
                </div>
                <h3>Suscipit ipsam cupiditate voluptatem labore, impedit nulla perspiciatis consectetur</h3>
                <p>Suscipit ipsam cupiditate voluptatem labore, impedit nulla perspiciatis consectetur</p>
            </div>
        </div>
        <div class="footer">
            <p> The CSS Grid Challenge - Jesús Olazagoitia </p>
        </div>
    </div>
            
          
!
            
              @import url('https://fonts.googleapis.com/css?family=Oxygen:300,400,700|Playfair+Display');

$c-grey: #585a5d;
$c-link: #7c9614;



// general
* { box-sizing: border-box; }

body {
    font-family: 'Oxygen', sans-serif;
    line-height: 1.5;
    margin: 0;
    padding: 0;
}

p {
    font-family: 'Oxygen', sans-serif;
    line-height: 1.5;
    color: $c-grey;
}

h1, h2, h3 {
    font-family: 'Playfair Display', serif;
    font-weight: normal;
}

h1 { font-size: 2rem; }

h2 {
    font-family: 'Oxygen', sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: $c-grey;
    max-width: 20em;
    max-width: 40ch;
}

h3 { font-size: 1.3rem; }



// nav 
.nav {
    display: table;
    margin-bottom: 1em;
    justify-self: end;
    grid-row: 1 / 2;

    ul, li {
        margin: 0;
        padding: 0;
        list-style: none;
    }
    ul {
        display: table-row;
        display: flex;
        justify-content: flex-end;
    }
    li {
        display: table-cell;
    }

    a  {
        display: block;
        padding: 1em 0;
        margin-left: 2em;
        text-decoration: none;
        color: $c-link;
    }
}





// main-grid
.main {
    margin: auto;
    max-width: 1200px;
    display: grid;
    grid-template-columns: 1fr 1fr repeat(6, minmax(auto, 200px)) 1fr 1fr;
    grid-template-rows:auto minmax(61vh, min-content) auto 8em;
}

.articles, .header, .nav {
    grid-column: 3 / span 6;
}

.footer {
    clear: both;
    padding: 2em 0;
    grid-column: 1 / -1;
    font-size: .8em;
    text-align: center;
    background-color: #f4f4f4;

    display: flex;
    align-items: center;
    
    display: grid;
    align-content: center;	
}


.header {
    align-self: center;
    grid-row: 2 / 3;
    padding: 1em 0;
}





// articles 
.articles {
    margin-left: -3%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;

    grid-gap: 1em;
    display: grid;
    grid-row: 3 / 4;
    grid-column: 2 / span 8;
    grid-template-columns: repeat(auto-fill, 29ch);

    .article:nth-child(1){
        grid-column: 1 / 3;
        grid-row: 1 / 3;
    }

    .article:nth-child(5n -3),
    .article:last-child {
        grid-column: span 2;
    }
    .article:nth-child(5) {
        grid-row: span 2;
    }
}

.article {
    padding-bottom: 2rem;
    width: 30%;
    width: 42ch;
    margin-left: 3%;
    float: left;
}

.img-wrap {
    margin-bottom: 1rem;

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




// supports
@supports(display: grid) {
    .article {
        width: auto;
        margin: 0;
    }

    .articles {  margin-left: 0; }
    .main { max-width: 100%; }
}
            
          
!
999px
Loading ..................

Console