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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


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


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.


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.


                %h1 Accessible Responsive Background-Image Test
%h2 How can we communicate the role of images as css backgrounds?
%p Use cases:
  %li Responsive assets: preventing resources from loading on mobile using media queries
  %li Taking advantage of css background properties
  %li Scaling and cropping css background images
    %p Default: Img with alt attribute
    %h3 Beaker
  %img{'src'=>'', 'alt'=>'Beaker'}
    %p div with scalable background, role='img' and alt attribute
    %h3 Animal
      %div{'id'=>'img1', 'role'=>'img', 'aria-label'=>"Animal's smiling face", 'style'=>'background-image: url('}
    %p div with scalable background, role='img' and offscreen span
    %h3 The Swedish Chef
      %div{'id'=>'img2', 'role'=>'img', 'aria-described-by'=>'swedishChefLbl', 'style'=>'background-image: url('}
        %span.offscreen{'id'=>'swedishChefLbl'} The Swedish Chef with a spoon


  font-family: Menlo, Verdana, sans-serif
  text-align: left
  display: block
  left: -500000px
  position: absolute

  font-size: 1.5em
h2, h3
  font-size: 1em
  position: relative
  height: 0
  padding: 32% 0 0 0
  overflow: hidden
  max-width: 320px
  &> div
    background-repeat: no-repeat
    background-size: contain
    bottom: 0
    left: 0
    min-width: 100%
    max-width: 100%
    position: absolute
    right: 0
    top: 0
      padding-top: 64%