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 Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

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.

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 id="homeGrid">
<ul>
  <li class="grid-1-1 horiz2"><div><p>Title 1 </p></div></li>
  <li class="grid-1-2 horiz2"><div><p>Title 2</p></div></li>
  <li class="grid-1-2"><div><p>Title 3</p></div></li>
  <li class="grid-2-2 horiz2"><div><p>Title 4</p></div></li>
  <li class="vert2"><div><p>Title 7</p></div></li>
  <li class="grid-3-1 horiz2 up1"><div><p>Title 5</p></div></li>
  <li class="grid-3-2 up1"><div><p>Title 6</p></div></li>
</ul>
</div>
            
          
!
            
              //Customize your boxes
$title-box-color: #AFD7D6;
$off-color: rgba(235, 193, 181, .3);
$base-id: homeGrid;
$cw: 100vw;
$w: .25 * $cw;
$h: $w;
$square: 178px;
$image-prefix: "https://s3-us-west-2.amazonaws.com/s.cdpn.io/11614";
@mixin transition() {
    transition: all .5s ease-in-out;
}

//End customization


//Mini Reset
* {
  padding: 0;
  margin: 0;
  border: 0;
  box-sizing: border-box;
}

img {
  margin: 0;
  border: 0;
  width: auto;
  height: 100%;
}
//End Reset

[id=#{$base-id}] {
  ul {
    font-size: 0;
    display: flex;
    justify-content: flex-start;
    flex-flow: row wrap;
    width: 100%;
    margin: auto;
    li {
      border: solid 1px #fff;
      position: relative;
      height: $h;
      flex: 1 0 $w;
      max-width: $w;
      overflow: hidden;
      display: inline-block;
      background: url(#{$image-prefix}/grid-2-1.jpg) no-repeat 0% 0% / 100% 100%;
      @include transition();
      &.grid-3-2 {
        background: url(#{$image-prefix}/grid-3-2.jpg)
      }
      div {
        font: bold 12px/1.2 Arial, sans-serif;
        background: $title-box-color;
        color: white;
        width: $w;
        height: $h;
        position: absolute;
        text-align: center;
        right: $w * 1;
        display: flex;
        @include transition();
        p {
          text-align: center;
          margin: auto;
          font-size: 16px;
          font-weight: normal;
          &:before {
            content: "\ff0b";//plus (+) sign
            font-weight: bold;
            display: inline-block;
            width: 100%;
            margin-top: -10px;
            font-size: 20px;
          }
        }
      }
      &:before {
        content: '';
        display: inline-block;
        background: $off-color;
        width: $w;
        height: $h;
        position: absolute;
        left: 0;
        top: 0;
        @include transition();
      }
      &:hover {
        &:before {
          background: rgba(0, 0, 0, 0);
          @include transition();
        }
        div {
          right: 0;
          @include transition();
        }
      }
      &.horiz2 {
        flex: 2 1 $w * 2;
        max-width: $w * 2;
        background-image: url(#{$image-prefix}/grid-1-1.jpg);
        &.grid-1-2 {
          background-image: url(#{$image-prefix}/grid-1-2.jpg);
        }
        &.grid-2-2 {
          background-image: url(#{$image-prefix}/grid-2-2.jpg);
        }
        &.grid-3-1 {
          background-image: url(#{$image-prefix}/grid-3-1.jpg);
        }
        div {
          right: $w * -1;
        }
        &:before {
          width: $w * 2;
        }
        &:hover {
          background-position: 67% 50%;
          background-size: 122% 122%;
          @include transition();
          div {
            right: 0;
          }
        }
      }
      &.vert2 {
        height: $h * 2;
        background-image: url(#{$image-prefix}/grid-2-3.jpg);
        div {
          right: 0;
          bottom: $w *-1;
        }
        &:before {
          height: $h *2;
        }
        &:hover div {
          bottom: 0;
        }
      }
      &.up1 {
        margin-top: $w * -1;
      }
    } //li
  } //ul
  @media (min-width: $square*4) {
    ul {
      width: $square*4;
      li {
        height: $square;
        flex: 1 0 $square;
        max-width: $square;
        div {
          width: $square;
          height: $square;
          right: $square;
        }
        &:before {
          width: $square;
          height: $square;
        }
        &:hover {}
        &.horiz2 {
          flex: 2 1 $square*2;
          max-width: $square*2;
          div {
            right: $square * -1;
          }
          &:before {
            width: $square * 2;
          }
        }
        &.vert2 {
          height: $square * 2;
          div {
            right: 0;
            bottom: $square * -1;
          }
          &:before {
            height: $square * 2;
          }
        }
        &.up1 {
          margin-top: $square * -1;
        }
      } //li
    } //ul  
  }
  @media (max-width: 414px) and (orientation: portrait) {
    ul {
      width: $cw;
      li {
        height: $cw/2;
        flex: 1 0 $cw/2;
        max-width: $cw/2;
        div {
          width: $cw/2;
          height: $cw/2;
          right: $cw/2;
        }
        &:before {
          width: $cw/2;
          height: $cw/2;
        }
        &:hover {}
        &.horiz2 {
          flex: 2 0 $cw;
          max-width: $cw;
          div {
            right: $cw/-2;
          }
          &:before {
            width: $cw;
          }
        }
        &.vert2 {
          height: $cw;
          div {
            right: 0;
            bottom: $cw/-2;
          }
          &:before {
            height: $cw;
          }
        }
        &.up1 {
          margin-top: 0;
        }
        &:nth-child(1) {
          order: 1;
        }
        &:nth-child(2) {
          order: 2;
        }
        &:nth-child(3) {
          order: 3;
        }
        &:nth-child(4) {
          order: 6;
        }
        &:nth-child(5) {
          order: 3;
        }
        &:nth-child(6) {
          order: 6;
        }
        &:nth-child(7) {
          order: 4;
          margin-top: $cw/-2;
        }
      } //li
    } //ul  
  }
}
            
          
!
999px
Loading ..................

Console