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

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.

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

              
                <h1>Example of non-symmetrical grid-based layout.</h1>
<p>This example is from part of this site: <a href="https://fillet.com.br/">https://fillet.com.br/</a>. While that site uses flex and a WordPress Elementor to build it (with some other things thrown in), this example uses a more relatively simple CSS grid to build the layout.</p>

<section class="asymmetrical-layout">
  <div class="item one"><img src="https://picsum.photos/1015/540" alt="item one"></div>
  <div class="item two"><img src="https://picsum.photos/630/1080" alt="item two"></div>
  <div class="item three"><img src="https://picsum.photos/630/500" alt="item three"></div>
  <div class="item four"><img src="https://picsum.photos/630/1080" alt="item four"></div>
  <div class="item five"><img src="https://picsum.photos/660/540" alt="item five"></div>
  <div class="item six"><img src="https://picsum.photos/630/500" alt="item six"></div>
  
</section>

<h2>Alternate version</h2>

<p> Here is a similar example but this time the images are background images so that we don't have to fiddle with the image sizes so much to have the heights line up. There are other ways to do this by putting the images in containers and using things like overflow: hidden in the CSS. 
</p>
<p>
Because browsers don't desribe background images in screen readers, you should have some HTML in each section.  </p>

<section class="asymmetrical-layout2">
  <div class="item bg-one">item bg-one</div>
  <div class="item bg-two">item bg-two</div>
  <div class="item bg-three">item bg-three</div>
  <div class="item bg-four">item bg-four</div>
  <div class="item bg-five">item bg-five</div>
  <div class="item bg-six">item bg-six</div>
  
</section>
              
            
!

CSS

              
                /* ================= Use Border Box model ================= */
html {
  box-sizing: border-box;
}
*, *:before, *:after {
  box-sizing: inherit;
}

/* ================= Basic Responsive Images and Video ================= */
img,video{
  width: auto;
  height: auto;
  max-width: 100%;
}

.asymmetrical-layout{
  display: grid;
  grid-template-columns: repeat(1,1fr );
  grid-gap: 20px;
}
@media screen and (min-width: 600px){
  .asymmetrical-layout{
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(4,1fr);
  }
  .one{
    grid-column: span 3;
  } 
  .four{
    grid-row: span 2;
  }
  .five{
    grid-column: span 2;
    grid-row: span 2;
  }
}


/* HEre is a similar example but this time the images are background images so that we don't have to fiddle with the image sizes so much to have the heights line up. There are other ways to do this by putting the images in containers and using things like overflow: hidden in the CSS.  */

/* because browsers don't desribe background images in screen readers, you should have some HTML in each section.  */
.asymmetrical-layout2{
  display: grid;
  grid-template-columns: repeat(1,1fr );
  grid-auto-rows: minmax(300px, auto);
  grid-gap: 20px;
}
  .asymmetrical-layout2 .item{
    background-size: cover;
    
/*     style the text in the items. center it,make it white and give a border with text shadow */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-family: sans-serif;
    color: #fff;
    text-shadow:
   -1px -1px 0 #000,  
    1px -1px 0 #000,
    -1px 1px 0 #000,
     1px 1px 0 #000;
  }
.bg-one{
    background-image: url(https://picsum.photos/1015/540);
  } 
  .bg-two{
    background-image: url(https://picsum.photos/315/540);
  }
  .bg-three{
    background-image: url(https://picsum.photos/315/250);
  }
  .bg-four{
    background-image: url(https://picsum.photos/315/540);
  }
  .bg-five{
    background-image: url(https://picsum.photos/660/540);
  }
  .bg-six{
    background-image: url(https://picsum.photos/315/250);
  }
@media screen and (min-width: 800px){
  .asymmetrical-layout2{
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(4,1fr);
    grid-auto-rows: minmax(170, auto);
  }
  .bg-one{
    grid-column: span 3;
    grid-row: span 2;
  } 
  .bg-two{
    grid-row: span 2;
  }
  .bg-three{
  }
  .bg-four{
    grid-row: span 2;
  }
  .bg-five{
    grid-column: span 2;
    grid-row: span 2;
  }
  .bg-six{
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console