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="container1">
  <div class="item1">item1</div>
  <div class="item2">item2</div>
  <div class="item3">item3</div>
  <div class="item4">item4</div>
  <div class="item5">item5</div>
  <div class="item6">item6</div>
</div>

<div class="container2">
  <div class="item1">item1</div>
  <div class="item2">item2</div>
  <div class="item3">item3</div>
  <div class="item4">item4</div>
  <div class="item5">item5</div>
  <div class="item6">item6</div>
</div>

<div class="container3">
  <div class="item1">item1</div>
  <div class="item2">item2</div>
  <div class="item3">item3</div>
  <div class="item4">item4</div>
  <div class="item5">item5</div>
  <div class="item6">item6</div>
</div>

<div class="container4">
  <div class="item1">item1</div>
  <div class="item2">item2</div>
  <div class="item3">item3</div>
  <div class="item4">item4</div>
  <div class="item5">item5</div>
  <div class="item6">item6</div>
</div>

<div class="container5">
  <div class="item1">item1</div>
  <div class="item2">item2</div>
  <div class="item3">item3</div>
  <div class="item4">item4</div>
  <div class="item5">item5</div>
  <div class="item6">item6</div>
</div>
            
          
!
            
              
*, *:before, *:after {
  box-sizing: border-box;
}
@mixin container {
  display: grid;
  border: dashed 2px #242424;
  color: #F2F3F4;
  padding: 5px;
  margin-bottom: 30px;
  position: relative;

  $content: "#{&}";
  &:before {
    position: absolute;
    right: 5px;
    bottom: 0;
    content: $content;
    color: black;
  }
}
$colors: #78281F, #943126, #B03A2E,
         #CB4335, #E74C3C, #EC7063;
$items: item1, item2, item3, item4, item5, item6;         

@each $color in $colors {
  $index: index($colors, $color);
  .item#{$index} {
    background-color: #{$color};
  }
}

.container1 {
  @include container;
}

.container2 {
  @include container;
  > .item1 {
    grid-row: 2;
  }
}

.container3 {
  @include container;
  > .item1 {
    grid-column: 1 / span 2;
  }
}

.container4 {
  @include container;
  min-height: 500px;
  grid-template-rows: 100px 1fr 100px;
  grid-template-columns: 150px 1fr;

  > .item1 {
    grid-row: 1;
    grid-column: 1 / span 2;
  }
  > .item2 {
    grid-row: 2;
    grid-column: 1;
  }
  > .item3 {
    grid-row: 2;
    grid-column: 2;
  }
  > .item4 {
    grid-row: 3;
    grid-column: 1 / span 2;
  }
  > .item5 {
    display: none;
  }
  > .item6 {
    display: none;
  }
}

.container5 {
  @include container;
  min-height: 500px;
  grid-template-rows: 100px 1fr 1fr 100px;
  grid-template-columns: 100px 1fr 100px;
  grid-template-areas:
    "item1 item1 item1"
    "item2 item3 item4"
    "item2 item3 item5"
    "item6 item6 item6";

  @each $item in $items {
    $index: index($items, $item);
    > .#{$item} {
      grid-area: #{$item};
    }
  }
}


            
          
!
999px
Loading ..................

Console