cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

            
              <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
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console