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.

  h1 This is an example of the crossfade() function for blending background images.

      label.title Change Cross-Fade
      input(id="cross-fade-slider", type="range", min="0", max="100")
      label Cross Fade =  
      span.percentage-output 50%
    | .hero { background-image: cross-fade (<span class="css-output-value">50</span>% url(https://cdn-images-1.medium.com/max/1600/1*o_vIFnBwhQIXh4qrzEYz7A.jpeg), url(https://www.desktopbackground.org/download/1600x900/2011/05/01/196572_audrey-hepburn-wallpapers-high-resolution-and-quality-download_2560x1920_h.jpg)); }

  margin: 0

  height: 600px
  width: 100%
  // The cross fade % controls the opacity of the first image 
  // Note: to have a smooth transition with the slider, choose two images exactly the same size. Otherwise, you get a weird resizing thing.
    image: cross-fade(50% url(https://cdn-images-1.medium.com/max/1600/1*o_vIFnBwhQIXh4qrzEYz7A.jpeg), url(https://www.desktopbackground.org/download/1600x900/2011/05/01/196572_audrey-hepburn-wallpapers-high-resolution-and-quality-download_2560x1920_h.jpg))
    position: center
    size: cover
    repeat: no-repeat
  padding: 1rem
  margin: 0  
// slider controls

  display: flex
  justify-content: space-around
  max-width: 1200px
  margin: 2rem auto
  background: #f9f9f9
  padding: 1rem
  flex: 0 1 30%
  text-align: center
  font-size: 1.2rem
  font-weight: 700
  padding: 1rem 2rem
  line-height: 1.5
  border-left: 1px solid #ddd
  margin-left: 2rem
              $('#cross-fade-slider').on('input', function() {
  var $this = $(this);
  // the present slider value
  var sliderValue = $this.val();
  // output the present slider value
  $('.percentage-output').html(sliderValue + '%');
  // Webkit has a different way to write the function so you have to include that here, too
    'background-image' : 'cross-fade(' + sliderValue + '% url(https://cdn-images-1.medium.com/max/1600/1*o_vIFnBwhQIXh4qrzEYz7A.jpeg), url(https://www.desktopbackground.org/download/1600x900/2011/05/01/196572_audrey-hepburn-wallpapers-high-resolution-and-quality-download_2560x1920_h.jpg))',
    'background-image' : '-webkit-cross-fade(url(https://cdn-images-1.medium.com/max/1600/1*o_vIFnBwhQIXh4qrzEYz7A.jpeg), url(https://www.desktopbackground.org/download/1600x900/2011/05/01/196572_audrey-hepburn-wallpapers-high-resolution-and-quality-download_2560x1920_h.jpg), ' + sliderValue + '%)'
Loading ..................