Pen Settings

HTML

CSS

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.

+ 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

              
                <div class="container">
  <h1 class="title">Gradient filtering images <small>(if images don't load, refresh)</small></h1>
  <div class="item item--first">
    <img src="https://unsplash.imgix.net/reserve/ujKaaIATKKx7vi5kkfQn__DSC3932.jpg?q=75&fm=jpg&auto=format&s=24fe0c29ff6e9bc2960b48be91490279" />
  </div>
  <div class="item item--second">
    <img src="https://unsplash.imgix.net/46/Ov6ZY1zLTWmhPC0wFysP_IMG_2896_edt.jpg?q=75&w=1080&h=1080&fit=max&fm=jpg&auto=format&s=6518e4df89659818f6c0392175a9c5e6" />
  </div>
  <div class="item item--third">
    <img src="https://unsplash.imgix.net/46/iYvDeqVGRbebiQv2PIJi_DSC_8407.JPG?q=75&fm=jpg&auto=format&s=6fb0462bfb28087768cf7c44520d2eb0" />
  </div>
  <div class="item item--fifth item--text">
    <ol>
      <li>I grayscale &amp; lower the contrast of images by 20% via a filter (Chrome/Safari only) to make the gradients a bit nicer.</li>
      <li>If this was ever implemented, I personally would process images either in Photoshop or on the server, as described above.</li>
      <li>I want to add more pics. I have more gradients (scroll through the CSS to line 102), just need to find nice images.</li>
      <li>Images from <a href="http://unsplash.com">Unsplash</a>, inspired by <a href="http://theverge.com">The Verge</a>.</li>
    </ol>
  </div>
  <div class="item item--fourth">
    <img src="https://unsplash.imgix.net/45/tkLOe7nnQ7mnMsiuijBy_hm.jpg?q=75&fm=jpg&auto=format&s=f370fb6d5c06573c5aa7d1f1ae41f1df" />
  </div>
  <div class="item item--sixth"> 
    <img src="https://unsplash.imgix.net/uploads%2F1411419068566071cef10%2F7562527b?q=75&w=1080&h=1080&fit=max&fm=jpg&auto=format&s=240c45655f09c546232a6f106688e502" />
  </div>
  <div class="item item--eighth">
    <img src="https://unsplash.imgix.net/45/ZLSw0SXxThSrkXRIiCdT_DSC_0345.jpg?q=75&w=1080&h=1080&fit=max&fm=jpg&auto=format&s=857f07b76abac23a7fb7161cc7b12a46" />
  </div>
  <div class="item item--seventh">
    <img src="https://unsplash.imgix.net/reserve/m6rT4MYFQ7CT8j9m2AEC_JakeGivens%20-%20Sunset%20in%20the%20Park.JPG?q=75&w=1080&h=1080&fit=max&fm=jpg&auto=format&s=6365b53b83834a1c4b12e307c0c48145" />
  </div>
</div>
              
            
!

CSS

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

body {
  font: normal 16px/1.4 'Source Sans Pro',sans-serif;
  margin: 0;
}

img {
  max-width: 100%;
  vertical-align: middle;
  -webkit-filter: grayscale(100%) contrast(0.9);
  -moz-filter: grayscale(100%) contrast(0.9);
  filter: grayscale(100%) contrast(0.9);
}

a {
  color: #428bca;
}

.container {
  margin: 0 auto;
  max-width: 500px;
}

  .title {
    text-align: center;
    font-weight: normal;
    margin-top: 25px;
    margin-bottom: 25px;
  }

  .item {
    position: relative;
    margin-bottom: 25px;
    border-radius: 2px;
    overflow: hidden;
    box-shadow: 0 1px 8px rgba(0,0,0,0.15);
  }

  .item:after {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    opacity: 0.55;
  }

  .item--first:after {
    background-image: linear-gradient(45deg, darken(#13abdb,5%), #B10DC9);
  }

  .item--second:after {
    background-image: linear-gradient(80deg, orange, darken(darkred,2%));
    opacity: 0.55;
  }

  .item--third:after {
    background-image: linear-gradient(180deg, #28d6e4, #04f44f);
    opacity: 0.4;
  }

  .item--fourth:after {
    background-image: linear-gradient(45deg, lighten(navy,5%), lighten(purple,10%));
    opacity: 0.425;
  }

  .item--text {
    background-image: linear-gradient(90deg, #ededed, #dadada);
    padding: 15px;
  }

    .item--text ol {
      padding-left: 22px;
      margin-top: 0;
      margin-bottom: 0;
    }

      .item--text li {
        margin-bottom: 12px;
      }

  .item--sixth:after {
    background-image: linear-gradient(315deg, #e6ed53, #43c4ed);
    opacity: 0.45;
  }

  .item--seventh:after {
    background-image: linear-gradient(325deg, lighten(#13abdb,5%) 7%, #ff0000 90%);
    opacity: 0.475;
  }

  .item--eighth:after {
    background-image: linear-gradient(225deg, forestgreen 7%, orange);
    opacity: 0.5;
  }

  /* currently unused */

  .item--ninth:after {
    background-image: linear-gradient(75deg, #fb4530, #f92ff1);
  }

  .item--tenth:after {
    background-image: linear-gradient(135deg, #f3ef12, #dc16a6);
  }

  .item--eleventh:after {
    background-image: linear-gradient(270deg, #3101ee, #f90e49);
    opacity: 0.45;
  }

  .item--twelth:after {
    background-image: linear-gradient(270deg, #f59aa5, #48317f);
    opacity: 0.6;
  }

@media(min-width: 875px){
  .container {
    max-width: 875px;

  }
  
  .item {
    float: left;
    width: 400px;
    margin: 0 0 25px 25px;
  }
  
  .item--third {
    width: 825px;
  }
  
  .item--text {
    width: 825px;
  }
}

.title small {
  font-size: 15px;
}
              
            
!

JS

              
                
              
            
!
999px

Console