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.

            
              <header>
  <h1>This Demo uses <a href="http://gridbyexample.com/">CSS Grid</a>, <a href="https://css-tricks.com/snippets/css/a-guide-to-flexbox/">Flexbox</a>, & <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@supports">@supports</a></h1>
</header>

<div  class="sidebar">
  <h1>Minmax Area</h1>
  <p>Min: 150px</p>
  <p>Max: 400px</p>
</div>
<section class="top-left"></section>
<section class="top-right"></section>
<section class="bottom-left"></section>
<section class="bottom-right"></section>

<footer>
  <p>Make sure you are on Chrome 57+ or Firefox 52+</p>
</footer>

            
          
!
            
              // Shared Things

@import url('https://fonts.googleapis.com/css?family=Space+Mono');
$tri-color: yellow;
$img-sec-h: 45vh;
$gutter: 8px;

body {
  font-family: 'Space Mono';
  text-align: center;
  padding: 0;
  margin: 0;
}

// Flexbox within the grid
header, footer, section {
  display: flex;
  align-items: center;
  justify-content: center;
}

h1 {
  font-size: 1.4rem;
  line-height: 1.2;
}

a {
  color: #a60;
}

footer p {
 padding: 2em 0;
}

.sidebar {
  background: grey;
}

.top-left {
  background-image: url('https://source.unsplash.com/random');
}

.top-right {
  background-image: url('https://source.unsplash.com/category/buildings');
}

.bottom-left {
  background-image: url('https://source.unsplash.com/category/nature');
}

.bottom-right {
  background-image: url('https://source.unsplash.com/category/technology');
}

// This is just fun with blend modes because why not?
section {
  background-position: 50%;
  background-size: cover;
  position: relative;

  &:before {
    content: '';
    background-color: darkblue;
    mix-blend-mode: difference;
    width: $img-sec-h / 1.5;
    height: $img-sec-h / 1.5;
    border-radius: 50%;
  }
}

// Grid Things for super modern browsers!

@supports (display: grid) {
  body {
    // Grid!
    display: grid;
    grid-gap: $gutter;
    grid-template-columns: minmax(150px, 400px) auto;
    grid-template-rows: 10vh $img-sec-h $img-sec-h auto;
    grid-template-areas:
      "side     header       header"
      "side     top-left     top-right"
      "side     bottom-left  bottom-right"
      "footer   footer       footer";
  }
  
  .sidebar {
    grid-area: side;
  }

  header {
     grid-area: header;
  }

  footer {
    grid-area: footer;
  }

  .top-left {
    grid-area: top-left;
  }

  .top-right {
    grid-area: top-right;
  }

  .bottom-left {
    grid-area: bottom-left;
  }

  .bottom-right {
    grid-area: bottom-right;
  }
}

@supports not (display: grid) {
  body {
    display: flex;
    flex-flow: row wrap;
  }
  
  // set height on header
  header {
    height: 10vh;
  }
  
  header, footer {
    width: 100%;
  }
  
  // setting height and flex positions on image elements
  .top-left,
  .top-right,
  .bottom-left,
  .bottom-right {
    height: $img-sec-h;
    flex: 0 1 calc(50% - #{$gutter/2});
  }
  
  // gutter to match grid
  .top-left,
  .bottom-left {
    margin-right: $gutter;
  }
  
  .top-left,
  .top-right {
    margin-bottom: $gutter;
  }
}
            
          
!
            
              // This Demo requires CSS grid browser support
// Demo with Flexbox fallback is here:
// https://codepen.io/una/pen/BWPbzV
            
          
!
999px
Loading ..................

Console