<h1>CSS Grid example - Show Alert Box</h1>

<div class="alert for-grid">
    <p>Sorry, mate, your browser doesn't have support for CSS Grid Layout! Have a stack of kittens instead!</p>
    <p><a href="http://caniuse.com/#feat=css-grid">See the support status for Grid</a></p>

        

</div>


<div class="grid">


    <div class="grid__item">
        <img src="https://placekitten.com/1000/500" alt="" />
        
    </div>
    
    <div class="grid__item">
    
        <img src="https://placekitten.com/600/800" alt="" />
        
    </div>
    
    <div class="grid__item">
    
        <img src="https://placekitten.com/1000/800" alt="" />
        
    </div>
    
    
    <div class="grid__item">
    
        <img src="https://placekitten.com/400/900" alt="" />        

    </div>
    
    
    <div class="grid__item">
    
        <img src="https://placekitten.com/900/1000" alt="" />    
        
    </div>
    
    
    <div class="grid__item">
    
        <img src="https://placekitten.com/1200/800" alt="" />    
        
    </div>
    
    
    <div class="grid__item">
            <img src="https://placekitten.com/2000/700" alt="" />    

        
    </div>
    
    
        
    <div class="grid__item">
    
        <img src="https://placekitten.com/1500/400" alt="" />
        
    </div>
    
    
    
    <div class="grid__item">
    
        <img src="https://placekitten.com/1200/800" alt="" />    
        
    </div>
    
    
    <div class="grid__item">
            <img src="https://placekitten.com/2000/800" alt="" />    

        
    </div>
    
    
        
    <div class="grid__item">
    
        <img src="https://placekitten.com/1500/500" alt="" />
        
    </div>
    

    <div class="grid__item">
        <img src="https://placekitten.com/300/500" alt="" />
        
    </div>


</div>
@supports (display: grid) {
    .alert.for-grid {
        display: none;
    }
}


.alert {
    width: 90%;
    margin: auto;
    border: 1px solid darken(#ed6a5a, 10%);
    background-color: lighten(#ed6a5a, 20%);
    margin-bottom: 20px;
    padding: 10px 20px;
    text-align: center;
    color: #444;
    box-sizing: border-box;
    p {
        font-size: 18px;
        line-height: 1.2em;
        margin: 5px 0;
    }
}
.grid {
    display: grid;
    grid-template-rows: 1fr auto 1fr;
    grid-template-columns: 1fr 1fr 2fr 1fr;
    margin: auto;
    width: 90%;
    grid-column-gap: calc(5px + 1vw);
    grid-row-gap: calc(5px + 1vw);
    
    .grid__item {
        height: calc(100px + 20vw);
        &:nth-child(7) {
            grid-column: span 2;
        }
        &:nth-child(8) {
            grid-column: span 4;
        }
    }


    img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: top center;
    }

}

h1 {
    text-align: center;
    font-size: calc(1em + 3vw);
    margin: 0 0 calc(.3em + 2vw);
}

body {
    font-family: 'Open Sans', sans-serif;
    padding: 10px 0;
    background-color: #eff6e0;
    font-size: 16px;
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.