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.



  <!-- viewport meta must come before any media queries -->
  <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=2.0, user-scalable=yes, shrink-to-fit=no" />

  <!-- viewport-dependent video poster preloads -->
  <link rel="preload" href="" as="image" media="all and (min-width:480px)">
  <link rel="preload" href="" as="image" media="all and (max-width:479px)">

      My Shop
      <span class="width-display" id="width-display">TBD</span>
    <video id="hero-video" class="full-width-video" loop autoplay playsinline loop muted data-desktop-src="" data-desktop-poster="" data-mobile-src="" data-mobile-poster="">
      /* define our wide breakpoint for the desktop video - this must match the CSS and preloads! */
      const WIDE_VIEWPORT = 480;
      /* define a match on the media query for us to share logic with CSS in JS */
      const wideViewport = window.matchMedia(`(min-width: ${WIDE_VIEWPORT}px)`)

      function resizeVideo(wideViewport) {
        let videoEl = document.getElementById("hero-video");
        // default to mobile video source and poster
        let src = videoEl.dataset.mobileSrc;
        let poster = videoEl.dataset.mobilePoster;
        let widthDisplay = 'MOBILE';
        if (wideViewport.matches) {
          // override for desktop if the media query for a wide vieport matches
          src = videoEl.dataset.desktopSrc;
          poster = videoEl.dataset.desktopPoster;
          widthDisplay = 'DESKTOP';
        if (videoEl.src !== src) {
          // only override values if they differ
          videoEl.src = src;
          videoEl.poster = poster;
        document.getElementById('width-display').textContent = widthDisplay;
  <p>Bacon ipsum dolor amet frankfurter filet mignon pork loin buffalo, bacon bresaola beef ribs pig flank meatloaf ham hock chuck ground round shoulder. Spare ribs biltong pork chop pig, pork sirloin capicola. Tri-tip fatback tongue, capicola filet mignon landjaeger t-bone salami buffalo ball tip spare ribs. Picanha ham kevin brisket leberkas. Hamburger bresaola t-bone, leberkas ham chicken strip steak pork belly tongue buffalo turkey chislic ham hock shoulder. Pig pancetta capicola cupim flank. Cow jowl filet mignon, ribeye spare ribs t-bone burgdoggen fatback frankfurter ham tongue sirloin salami.</p>



                body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
header {
  position: relative;
  left: 0;
  top: 0;
  height: 2em;
  background: purple;
  padding: 0.5em;
  text-align: center;
header h1 {
  margin: -4px;
  color: white;
.full-width-video {
  width: 100%;
  aspect-ratio: 1280 / 960; /* width and height of the mobile video */
  background-color: black; /* to show pre-allocated space */
/* override for desktop */
@media only screen and (min-width: 480px) {
  .full-width-video {
    aspect-ratio: 1280 / 480;
.width-display {
  font-size: 50%;
  position: absolute;
  right: 1em;
  display: block;
  top: 1em;