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.wrapper
  div.gallery
    div.gallery-header
      div.gallery-title
        h1 Gallery
        h2 of some nice images
      div.search
        div.icon.material-icons search
        input.searchbox(placeholder="Search")
    div.gallery-body
      - var n = 0;
        while n < 8
          div.gallery-row(id=n++)
            div.gallery-item
              div.thumbnail
                img(src="https://unsplash.it/800/?random")
              div.meta
                h2.title Sed consequat luctus justo ut.
                div.description
                  p Mauris ornare condimentum ipsum ac vehicula. Sed euismod nec nibh nec sodales. Nulla volutpat et arcu nec bibendum. Vestibulum nec sagittis ex. Integer turpis nisl, mattis et dapibus non, semper vel magna.
                div.download
                  div.icon.material-icons file_download
                  a(href="#").label SVG
                  a(href="#").label PNG
            div.gallery-item
              div.thumbnail
                img(src="https://unsplash.it/1200/?random")
              div.meta
                h2.title Cras fringilla erat varius eros.
                div.description
                  p Nam elementum augue ut ante tempus elementum. Donec finibus consequat tortor. Nunc imperdiet ultrices venenatis.
                div.download
                  div.icon.material-icons file_download
                  a(href="#").label SVG
                  a(href="#").label PNG
    div.gallery-footer
      div.copyright
        p © 2017 Copyright Holder
      div.links
        a(href="#" title="Useful link") Useful link
        a(href="#" title="Helpful link") Helpful link
        a(href="#" title="Intersting link") Interesting link
            
          
!
            
              @mixin transition($args...) {
  -webkit-transition: $args;
  -moz-transition: $args;
  -ms-transition: $args;
  -o-transition: $args;
  transition: $args;
}

html {
  box-sizing: border-box;
}

*,
*:after,
*:before {
  box-sizing: inherit;
}

body {
  background-color: #333333;
  color: #ffffff;
  font-family: 'Titillium Web', sans-serif;
  font-size: 16px;
  height: 100%;
  margin: 0;
  padding: 0;
  width: 100%;
}

.wrapper {
  margin: 0 auto;
  width: 90%;
  background-color: #e2e2e2;
  @media screen and (min-width: 550px) {
    width: 80%;
  }
}

.gallery-header {
  width: 100%;
  position: relative;
  background-color: #222222;
  padding: 2rem;
  overflow: hidden;
  display: flex;
  flex-flow: row wrap;
}

.gallery-title {
  order: 1;
  width: 100%;
  h1,
  h2 {
    margin: 0;
  }
}

.search {
  order: 2;
  width: 100%;
  max-width: 30rem;
  height: 2rem;
  margin-top: 2rem;
  position: relative;
  overflow: hidden;
  .icon,
  .searchbox {
    position: absolute;
    @include transition(all, ease, .3s);
  }
  .icon {
    top: 50%;
    transform: translateY(-50%);
    left: .5rem;
    width: 100%;
    overflow-x: hidden;
    opacity: .5;
  }
  .searchbox {
    width: 100%;
    height: 100%;
    border: 1px solid fade-out(#fff, .5);
    background: none;
    color: #fff;
    outline: none;
    padding-left: 2.25rem;
  }
  &:hover {
    .searchbox {
      border-color: fade-out(#fff, .2);
    }
    .icon {
      opacity: 1;
    }
  }
}

@media screen and (min-width: 1024px) {
  .gallery-header {
    justify-content: space-between;
  }
  .gallery-title {
    width: 70%;
  }
  .search {
    width: 30%;
  }
}

.gallery-body {
  overflow: hidden;
  padding: 2rem;
}

.gallery-item {
  box-shadow: 0 10px 30px fade-out(#000, .8);
  float: left;
  height: 13rem;
  width: 100%;
  overflow: hidden;
  margin-bottom: 4%;
  position: relative;
  background-color: #e2e2e2;
  &:hover,
  &:focus {
    .thumbnail {
      transform: scale(1.1, 1.1);
    }
    .meta {
      background-color: fade-out(#000, .6);
    }
  }
  @media screen and (min-width: 425px) {
    height: 20rem;
  }
  @media screen and (min-width: 550px) {
    height: 12rem;
  }
  @media screen and (min-width: 1024px) {
    height: 16rem;
  }
  @media screen and (min-width: 1440px) {
    height: 24rem;
  }
  @media screen and (min-width: 2560px) {
    height: 40rem;
  }
}

.thumbnail {
  position: relative;
  width: 100%;
  height: inherit;
  @include transition(ease, all, .5s);
  img {
    display: block;
    position: absolute;
    width: 100%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
}

.gallery-row {
  width: 100%;
}

@media screen and (min-width: 550px) {
  .gallery-item {
    &:first-child {
      margin-right: 4%;
    }
  }
  .gallery-row {
    &:nth-child(2n) {
      .gallery-item {
        &:first-child {
          width: 34%;
        }
        &:last-child {
          width: 62%;
        }
      }
    }
    &:nth-child(2n+1) {
      .gallery-item {
        &:first-child {
          width: 62%;
        }
        &:last-child {
          width: 34%;
        }
      }
    }
  }
}

.meta {
  z-index: 1200;
  height: 100%;
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background-color: fade-out(#000, .5);
  color: #fff;
  & > * {
    position: absolute;
  }
  .title {
    text-transform: uppercase;
    font-weight: 300;
    top: 50%;
    left: 50%;
    width: 100%;
    transform: translate(-50%, -50%);
    text-align: center;
    font-size: 1rem;
    padding: 1rem;
  }
  .description {
    display: none;
    padding: 1rem;
    max-height: 60%;
    overflow: hidden;
  }
  .download {
    bottom: 1rem;
    left: 1rem;
    opacity: .8;
    .icon,
    .label {
      display: inline-block;
      vertical-align: middle;
      &:not(:first-child) {
        margin-left: .5rem;
      }
    }
    .label {
      text-decoration: none;
      &, &:visited {
        color: #fff;
      }
      &:hover, &:focus {
        font-weight: 600;
      }
    }
  }
  @media screen and (min-width: 1024px) {
    .title {
      font-size: 1.2rem;
      text-align: left;
      top: 10%;
    }
    .description {
      display: block;
      top: 15%;
    }
  }
  @media screen and (min-width: 1440px) {
    .title {
      font-size: 1.6rem;
      text-align: left;
      top: 10%;
    }
    .description {
      font-size: 1.2rem;
      display: block;
      top: 15%;
    }
  }
  @media screen and (min-width: 2560px) {
    .title {
      font-size: 2rem;
      text-align: left;
      top: 10%;
    }
    .description {
      font-size: 1.5rem;
      display: block;
      top: 15%;
    }
  }
}

.gallery-footer {
  background-color: #222;
  padding: 2rem;
  .copyright {
    opacity: .5;
    p {
      margin: 0;
    }
  }
  .links {
    margin-top: 1rem;
    a {
      text-decoration: none;
      display: block;
      position: relative;
      vertical-align: middle;
      &,
      &:visited {
        color: #fff;
      }
      &:hover,
      &:focus {
        font-weight: 600;
      }
      &:after {
        display: block;
        content: attr(title);
        font-weight: bold;
        height: 1px;
        color: transparent;
        overflow: hidden;
        visibility: hidden;
        margin-bottom: -1px;
      }
    }
  }
  @media screen and (min-width: 550px) {
    display: flex;
    justify-content: space-between;
    .links {
      margin-top: 0;
      a {
        display: inline-block;
        &:not(:first-child) {
          &:before {
            display: inline-block;
            content: '';
            width: 1px;
            height: 1em;
            background-color: #fff;
            margin-left: 1em;
            margin-right: 1em;
            vertical-align: middle;
          }
        }
      }
    }
  }
}
            
          
!
999px
Loading ..................

Console