css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div class="wrapper">
  <div class="tunnel tunnel1"></div>
  <div class="tunnel tunnel2"></div>
  <div class="tunnel tunnel3"></div>
</div>

<!--
  SVG Background Images Performance tips!

  1. The FPS gets better the smaller the SVG file.
  2. Set your vector graphic's artboard/canvas to be as close to the reproduced size as possible. When in doubt as to the final size, go large. With vectors, larger canvases don't take more bytes than small ones, but they'll render nicer, especially in FireFox.
  3. To avoid sub-pixel anti-aliasing between tiled images, make sure your artboard is in whole pixels.
  4. In Illustrator, save as SVG 1.1 and "Clip to artboard!"
  
  In the CSS and markup!
  Originally I tried to do multiple animated backgrounds, like I've done before with PNGs: http://24ways.org/2012/flashless-animation/
  But the performance was TERRIBLE, especially in FireFox and on my iPhone 4s. Then @askoth made a demo doing the same thing by arranging the background into several div tiles and using translate to animate them upward: https://codepen.io/anon/pen/ulbHA

  What happens is that rather than calculating the background CONSTANTLY, the browser is able to "bake" a few tiles and shift them around. This gives us very nearly 60fps in Chrome and makes it look great in Firefox.
-->
            
          
!
            
              html { height: 100%;}
body { background: #000; height: 100%;}
@keyframes fall {
  0% { 
    transform: translate(0, 0)
  }
  100% {
    transform: translate(0, -900px)
  }
}

.wrapper {
  background: #5A4F4A;
	margin: 0 auto;
  width: 530px; height: 100%;
  overflow: hidden;
  position: relative;
}

.tunnel {
  animation: fall 6s linear infinite;
	width: 100%; height: 900px;
	background: 
		url(http://stash.rachelnabors.com/codepen/alice/bg-tunnel-border-left.svg?1) 0 0 repeat-y,
		url(http://stash.rachelnabors.com/codepen/alice/bg-tunnel-border-right.svg?1) 100% 0 repeat-y,
		url(http://stash.rachelnabors.com/codepen/alice/bg-tunnel-furniture-comp900.svg) top center repeat-y,
		url(http://stash.rachelnabors.com/codepen/alice/bg-tunnel-specks.png);
	background-size: 
		20px 150px, 
		20px 150px, 
		auto 900px,
		auto auto
  position: absolute;
  left: 0; top: 0;
}

.tunnel2 {
  top: 900px;
}

.tunnel3 {
  top: 1800px;
}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console