Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!--[if lt IE 10]> 
<style>
h1 {
    line-height: 100px;
    width: 100%;
}
.grid {
    margin: 0 auto;
    padding: 50px 100px 0px 100px;
    max-width: 1200px;
}
.first-line {
    height: 20px;
    width: 100%;
    margin-top: 20px;
    background-color: #000;
}
.main {
    cursor: pointer;
    width: 100%;
    margin: 20px 0;
}
.mainimg {
    background-size: cover;
    height: 220px;
    width: 100%;
    margin-bottom: 20px;
}
h2 {
    font-size: 40.5px;
    line-height: 31.5px;
    margin-bottom: 13px;
}
.main > p {
    width: 80%;
}
.mainhr {
    height: 2px;
    background-color: #000;
    margin-top: 20px;
    width: 20px;
}
.side1 {
    width: 100%; /* ie8 */
    width: calc(33.333% - 13.333px);
    margin-right: 20px;
    float: left;
}
.side2 {
    width: 100%; /* ie8 */
    width: calc(33.333% - 13.333px);
    margin-right: 20px;
    float: left;
}
.side3 {
    width: 100%; /* ie8 */
    width: calc(33.333% - 13.333px);
    float: left;
}
.side1,
.side2,
.side3 {
    margin-bottom: 20px;
}
.morehr {
    height: 2px;
    width: 100%;
    background-color: #000;
    margin-top: 20px;
    clear: left;
}
h4 {
    width: 100%;
    margin-top: 20px;
    margin-bottom: 20px;
}
.ex1 {
    width: 100%; /* ie8 */
    width: calc(33.333% - 13.333px);
    margin-right: 20px;
    float: left;
}
.ex2 {
    width: 100%; /* ie8 */
    width: calc(33.333% - 13.333px);
    margin-right: 20px;
    float: left;
}
.ex3 {
    width: 100%; /* ie8 */
    width: calc(33.333% - 13.333px);
    float: left;
}
.ex1,
.ex2,
.ex3 {
    margin-bottom: 20px;
}
.eximg1,
.eximg2,
.eximg3 {
    height: 220px;
    background-size: cover;
    margin-bottom: 20px;
}
.footer {
    display: block;
    height: 100px;
    width: 100%;
    background-color: #000000;
    clear: both;
}
footer ul {
    list-style: none;
    width: 100%;
}
footer li {
    width: 25%;
    float: left;
}
footer a {
    color: #fff;
    text-decoration: none;
    line-height: 100px;
    text-align: center;
    width: 100%;
    display: block;
    font-family: oswald, helvetica, sans-serif;
    font-weight: normal;
    font-size: 12px;
}
@media all and (max-width: 1000px) {
    .grid {
        padding: 50px 50px 0px 50px;
    }
}
@media all and (max-width: 620px) {
    .grid {
        padding: 25px 20px 0px 20px;
    }
    h1 {
        font-size: 60.75px;
        line-height: 1.3;
    }
    .side1 {
        width: 100%;
        margin-right: 0;
    }
    .side2 {
        width: 100%;
        margin-right: 0;
    }
    .side3 {
        width: 100%;
    }
    .sidehr {
        margin-top: 20px;
        background-color: #000;
        height: 2px;
        width: 20px;
    }
    h2 {
        font-size: 27px;
    }
    .ex1 {
        width: 100%;
        margin-right: 0;
    }
    .ex2 {
        width: 100%;
        margin-right: 0;
    }
    .ex3 {
        width: 100%;
    }
}    
</style>
<script>
  document.createElement('footer');
</script>
<![endif]-->
    
<body>
   
   <div class="grid">
       <h1>CSS Grid Layout</h1>
       <hr class="first-line">
       <div class="main">
           <div class="mainimg"></div>
           <h2>Most powerful layout system </h2>
           <p>Is a two-dimensional grid-based layout system that aims to do nothing less than completely change the way we design grid-based user interfaces.</p>
           <hr class="mainhr">
       </div>
       <div class="side1">
           <h3>Basics and Browser Support</h3>
           <p>To get started you have to define a container element as a grid with display: grid, set the column and row sizes with grid-template-columns and grid-template-rows, and then…</p>
           <hr class="sidehr">
       </div>
       <div class="side2">
           <h3>Basics and Browser Support</h3>
           <p>To get started you have to define a container element as a grid with display: grid, set the column and row sizes with grid-template-columns and grid-template-rows, and then…</p>
           <hr class="sidehr">
       </div>
       <div class="side3">
           <h3>Basics and Browser Support</h3>
           <p>To get started you have to define a container element as a grid with display: grid, set the column and row sizes with grid-template-columns and grid-template-rows, and then…</p>
           <hr class="sidehr">
       </div>
       <hr class="morehr">
       <h4>Examples</h4>
       <div class="ex1">
           <div class="eximg1"></div>
           <h3>Basics and Browser Support</h3>
           <p>To get started you have to define a container element as a grid with display: grid, set the column and row sizes with grid-template-columns and grid-template-rows, and then…</p>
       </div>
       <div class="ex2">
           <div class="eximg2"></div>
           <h3>Basics and Browser Support</h3>
           <p>To get started you have to define a container element as a grid with display: grid, set the column and row sizes with grid-template-columns and grid-template-rows, and then…</p>
       </div>
       <div class="ex3">
           <div class="eximg3"></div>
           <h3>Basics and Browser Support</h3>
           <p>To get started you have to define a container element as a grid with display: grid, set the column and row sizes with grid-template-columns and grid-template-rows, and then…</p>
       </div>
       <footer class="footer">
           <ul class="footerlist">
               <li class="github"><a href="#">github</a></li>
               <li class="codepen"><a href="#">codepen</a></li>
               <li class="medium"><a href="#">medium</a></li>
               <li class="youtube"><a href="#">youtube</a></li>
           </ul>
       </footer>
   </div>
  
              
            
!

CSS

              
                * {
     margin: 0;
     padding: 0;
     border: 0;
 }
 h1,
 h2,
 h3,
 h4,
 .more {
     font-family: oswald, helvetica, sans-serif;
     font-weight: bold;
 }
 h1 {
     grid-column: 1/7;
     grid-row: 1/2;
     font-size: 91.12px;
     line-height: 100px;
 }
 h3 {
     font-size: 18px;
     line-height: 1.3;
     margin-bottom: 10px;
 }
 h2 {
     font-size: 40.5px;
     line-height: 31.5px;
     margin-bottom: 13px;
 }
 h4 {
     font-size: 27px;
     line-height: 27px;
     background-color: #fff;
 }
 p {
     font-family: Quattrocento, serif;
     font-size: 12px;
     line-height: 1.4;
 }
 .eximg1 {
     background-image: url(http://we3studio.pl/smashingmagazine/1.jpg);
 }
 .eximg2 {
     background-image: url(http://we3studio.pl/smashingmagazine/2.jpg);
 }
 .eximg3 {
     background-image: url(http://we3studio.pl/smashingmagazine/3.jpg);
 }
.mainimg {
     background-image: url(http://we3studio.pl/smashingmagazine/main.jpg);
 }
        

@supports (display: grid) {
    .grid {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        grid-template-rows: 100px 20px 100px 100px 100px 40px 100px 100px 100px 100px;
        grid-gap: 20px;
        margin: 0 auto;
        padding: 50px 100px 0px 100px;
        max-width: 1200px;
    }
    h1 {
        grid-column: 1/7;
        grid-row: 1/2;
    }
    .first-line {
        grid-column: 1/7;
        grid-row: 2/3;
        height: 20px;
        background-color: #000;
    }
    .main {
        grid-column: 3/7;
        grid-row: 3/5;
        cursor: pointer;
    }
    .mainimg {
        background-size: cover;
        height: 220px;
        width: 100%;
        margin-bottom: 20px;
    }
    .main > p {
        width: 80%;
    }
    .mainhr {
        display: none;
    }
    .side1,
    .side2,
    .side3 {
        position: relative;
        cursor: pointer;
    }
    .side1 {
        grid-column: 1/3;
        grid-row: 3/4;
    }
    .side2 {
        grid-column: 1/3;
        grid-row: 4/5;
    }
    .side3 {
        grid-column: 1/3;
        grid-row: 5/6;
    }
    .sidehr {
        height: 2px;
        background-color: #000;
        position: absolute;
        bottom: 0px;
        width: 20px;
    }
    h4 {
        grid-column: 1/2;
        grid-row: 6/7;
    }
    .morehr {
        height: 2px;
        width: 100%;
        background-color: #000;
        grid-column: 1/7;
        grid-row: 6/7;
        -webkit-align-self: center;
        -ms-flex-item-align: center;
        align-self: center;
    }
    .ex1 {
        grid-column: 1/3;
        grid-row: 7/10;
        cursor: pointer;
    }
    .ex2 {
        grid-column: 3/5;
        grid-row: 7/10;
        cursor: pointer;
    }
    .ex3 {
        grid-column: 5/7;
        grid-row: 7/10;
        cursor: pointer;
    }
    .eximg1,
    .eximg2,
    .eximg3 {
        height: 220px;
        width: 100%;
        background-size: cover;
        margin-bottom: 20px;
    }
    footer {
        background-color: #000;
        grid-column: 1/7;
        grid-row: 10/11;
    }
    .footerlist {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        grid-template-rows: 100px;
        list-style: none;
    }
    .footerlist a {
        color: #fff;
        text-decoration: none;
        font-family: oswald, helvetica, sans-serif;
        font-weight: normal;
        font-size: 12px;
    }
    .github {
        grid-column: 2/3;
        -webkit-align-self: center;
        -ms-flex-item-align: center;
        align-self: center;
        justify-self: center;
    }
    .codepen {
        grid-column: 3/4;
        -webkit-align-self: center;
        -ms-flex-item-align: center;
        align-self: center;
        justify-self: center;
    }
    .medium {
        grid-column: 4/5;
        -webkit-align-self: center;
        -ms-flex-item-align: center;
        align-self: center;
        justify-self: center;
    }
    .youtube {
        grid-column: 5/6;
        -webkit-align-self: center;
        -ms-flex-item-align: center;
        align-self: center;
        justify-self: center;
    }
    @media all and (max-width: 1000px) {
        .grid {
            padding: 50px 50px 0px 50px;
        }
    }
    @media all and (max-width: 870px) {
        .grid {
            grid-template-rows: auto 20px auto auto 40px auto 100px;
        }
        .main {
            grid-column: 1/7;
            grid-row: 3/4;
        }
        .mainhr {
            height: 2px;
            background-color: #000;
            margin-top: 20px;
            width: 20px;
            display: block;
        }
        .side1 {
            grid-column: 1/3;
            grid-row: 4/5;
        }
        .side2 {
            grid-column: 3/5;
            grid-row: 4/5;
        }
        .side3 {
            grid-column: 5/7;
            grid-row: 4/5;
        }
        .sidehr {
            display: none;
        }
        h4 {
            grid-column: 3/5;
            justify-self: center;
            grid-row: 5/6;
            padding: 0 20px;
        }
        .morehr {
            grid-row: 5/6;
        }
        .ex1 {
            grid-column: 1/3;
            grid-row: 6/7;
        }
        .ex2 {
            grid-column: 3/5;
            grid-row: 6/7;
        }
        .ex3 {
            grid-column: 5/7;
            grid-row: 6/7;
        }
        footer {
            grid-row: 7/8;
        }
    }
    @media all and (max-width: 620px) {
        .grid {
            padding: 25px 20px 0px 20px;
            grid-template-rows: auto 20px auto auto auto auto 40px auto auto auto 100px;
        }
        h1 {
            font-size: 60.75px;
            line-height: 1.3;
        }
        .side1 {
            grid-column: 1/7;
            grid-row: 4/5;
        }
        .side2 {
            grid-column: 1/7;
            grid-row: 5/6;
        }
        .side3 {
            grid-column: 1/7;
            grid-row: 6/7;
        }
        h2 {
            font-size: 27px;
        }
        .sidehr {
            display: block;
            position: relative;
            margin-top: 20px;
        }
        h4 {
            grid-row: 7/8;
        }
        .morehr {
            grid-row: 7/8;
        }
        .ex1 {
            grid-column: 1/7;
            grid-row: 8/9;
        }
        .ex2 {
            grid-column: 1/7;
            grid-row: 9/10;
        }
        .ex3 {
            grid-column: 1/7;
            grid-row: 10/11;
        }
        footer {
            grid-row: 11/12;
        }
        .footerlist {
            grid-template-columns: repeat(4, 1fr);
        }
        .github {
            grid-column: 1/2;
        }
        .codepen {
            grid-column: 2/3;
        }
        .medium {
            grid-column: 3/4;
        }
        .youtube {
            grid-column: 4/5;
        }
    }
}
    
/* flexbox fallback is the browser does not support display:grid */

@supports not (display: grid) {
    h1 {
        line-height: 100px;
        width: 100%;
    }
    .grid {
        display: -webkit-box;
        display: -webkit-flex;
        display: -ms-flexbox;
        display: flex;
        margin: 0 auto;
        padding: 50px 100px 0px 100px;
        max-width: 1200px;
        -webkit-flex-wrap: wrap;
        -ms-flex-wrap: wrap;
        flex-wrap: wrap;
    }
    .first-line {
        height: 20px;
        width: 100%;
        margin-top: 20px;
        background-color: #000;
    }
    .main {
        cursor: pointer;
        width: 100%;
        margin: 20px 0;
    }
    .mainimg {
        background-size: cover;
        height: 220px;
        width: 100%;
        margin-bottom: 20px;
    }
    h2 {
        font-size: 40.5px;
        line-height: 31.5px;
        margin-bottom: 13px;
    }
    .main > p {
        width: 80%;
    }
    .mainhr {
        height: 2px;
        background-color: #000;
        margin-top: 20px;
        width: 20px;
    }
    .side1 {
        -webkit-box-flex: 1;
        -webkit-flex: 1;
        -ms-flex: 1;
        flex: 1;
        margin-right: 20px;
    }
    .side2 {
        -webkit-box-flex: 1;
        -webkit-flex: 1;
        -ms-flex: 1;
        flex: 1;
        margin-right: 20px;
    }
    .side3 {
        -webkit-box-flex: 1;
        -webkit-flex: 1;
        -ms-flex: 1;
        flex: 1;
    }
    .morehr {
        height: 2px;
        width: 100%;
        background-color: #000;
        margin-top: 20px;
    }
    h4 {
        width: 100%;
        margin-top: 20px;
        margin-bottom: 20px;
    }
    .ex1 {
        -webkit-box-flex: 1;
        -webkit-flex: 1;
        -ms-flex: 1;
        flex: 1;
        margin-right: 20px;
    }
    .ex2 {
        -webkit-box-flex: 1;
        -webkit-flex: 1;
        -ms-flex: 1;
        flex: 1;
        margin-right: 20px;
    }
    .ex3 {
        -webkit-box-flex: 1;
        -webkit-flex: 1;
        -ms-flex: 1;
        flex: 1;
    }
    .eximg1,
    .eximg2,
    .eximg3 {
        height: 220px;
        background-size: cover;
        margin-bottom: 20px;
    }
    footer {
        height: 100px;
        width: 100%;
        background-color: #000;
        margin-top: 20px;
    }
    footer ul {
        list-style: none;
        width: 100%;
        display: -webkit-box;
        display: -webkit-flex;
        display: -ms-flexbox;
        display: flex;
        -webkit-flex-wrap: wrap;
        -ms-flex-wrap: wrap;
        flex-wrap: wrap;
    }
    footer li {
        -webkit-box-flex: 1;
        -webkit-flex: 1;
        -ms-flex: 1;
        flex: 1;
    }
    footer a {
        color: #fff;
        text-decoration: none;
        line-height: 100px;
        text-align: center;
        width: 100%;
        display: block;
        font-family: oswald, helvetica, sans-serif;
        font-weight: normal;
        font-size: 12px;
    }
    @media all and (max-width: 1000px) {
        .grid {
            padding: 50px 50px 0px 50px;
        }
    }
    @media all and (max-width: 620px) {
        .grid {
            padding: 25px 20px 0px 20px;
        }
        h1 {
            font-size: 60.75px;
            line-height: 1.3;
        }
        .side1 {
            -webkit-box-flex: 1;
            -webkit-flex: auto;
            -ms-flex: auto;
            flex: auto;
            margin: 0 0 20px 0;
        }
        .side2 {
            -webkit-box-flex: 1;
            -webkit-flex: auto;
            -ms-flex: auto;
            flex: auto;
            margin: 0 0 20px 0;
        }
        .side3 {
            -webkit-box-flex: 1;
            -webkit-flex: auto;
            -ms-flex: auto;
            flex: auto;
        }
        .sidehr {
            margin-top: 20px;
            background-color: #000;
            height: 2px;
            width: 20px;
        }
        h2 {
            font-size: 27px;
        }
        .ex1 {
            -webkit-box-flex: 1;
            -webkit-flex: auto;
            -ms-flex: auto;
            flex: auto;
            margin-right: 0;
            margin-bottom: 20px;
        }
        .ex2 {
            -webkit-box-flex: 1;
            -webkit-flex: auto;
            -ms-flex: auto;
            flex: auto;
            margin-right: 0;
            margin-bottom: 20px;
        }
        .ex3 {
            -webkit-box-flex: 1;
            -webkit-flex: auto;
            -ms-flex: auto;
            flex: auto;
        }
    }
}   
              
            
!

JS

              
                
              
            
!
999px

Console