Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                // Art direction

- const img = 'https://scriptura.github.io/medias/images/demo/test'
- const alt = 'Test picture'

figure
  picture
    source(
      media='(min-width: 1501px)',
      srcset=img + '-original.webp',
      sizes='100vw',
      type='image/webp'
    )
    source(
      media='(min-width:1001px) and (max-width:1500px)',
      srcset=img + '-w1500.webp, ' + img + '-w2000.webp 2x',
      sizes='100vw',
      type='image/webp'
    )
    source(
      media='(min-width:801px) and (max-width:1000px)',
      srcset=img + '-w1000.webp, ' + img + '-w2000.webp 2x',
      sizes='100vw',
      type='image/webp'
    )
    source(
      media='(min-width:601px) and (max-width:800px)',
      srcset=img + '-w800.webp, ' + img + '-w1500.webp 2x',
      sizes='100vw',
      type='image/webp'
    )
    source(
      media='(min-width:401px) and (max-width:600px)',
      srcset=img + '-w600.webp, ' + img + '-w1500.webp 2x',
      sizes='100vw',
      type='image/webp'
    )
    source(
      media='(min-width:301px) and (max-width:400px)',
      srcset=img + '-w400.webp, ' + img + '-w800.webp 2x',
      sizes='100vw',
      type='image/webp'
    )
    source(
      srcset=img + '-w300.webp',
      sizes='100vw',
      type='image/webp'
    )
    img(
      src=img + '-original.webp',
      type='image/webp',
      width='5301',
      height='3534',
      alt=alt,
      loading='lazy'
      )

              
            
!

CSS

              
                // for demo:

figure
  //vertical-align: middle
  max-width: 40rem
  margin: 0
  padding: .5em
  background-color: #555

img
  display: block
  width: 100%
  height: auto

body
  display: grid
  place-items: center
  min-height: 100vh
  margin: 0
  background-color: #333

              
            
!

JS

              
                // Art Direction

// @params 'w' indication sur la charge en px de l'image correspondante, '1x' valeur Retina...

// @link https://developers.google.com/web/fundamentals/design-and-ui/media/images/images-in-markup?hl=fr#amliorer-les-lments-img-avec-lattribut-srcset-pour-les-crans--haute-densit-de-pixels
// @link https://la-cascade.io/images-responsives-picture-et-srcset/
// @link http://www.hteumeuleu.fr/attribut-srcset-images-responsive/
// @link https://la-cascade.io/tag/images-responsives/
// @link https://css-tricks.com/a-guide-to-the-responsive-images-syntax-in-html/
// @link https://css-tricks.com/video-screencasts/133-figuring-responsive-images/
// @link http://www.alsacreations.com/article/lire/1621-responsive-images-srcset.html

              
            
!
999px

Console