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

              
                <!-- a string of lights, but they’re wired in parallel instead of serial.

M. Kupietz, https://michaelkupietz.com

Modified from tobyj's original demo at https://codepen.io/tobyj/pen/QjvEex -->

<ul id="lightrope">
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li class="broken"></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
</ul>
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>
There is now an enhanced interactive version of this at <a href="https://codepen.io/kupietz/pen/dPbNywN">https://codepen.io/kupietz/pen/dPbNywN</a> where you can knock the bulbs around with your mouse. Still CSS-only. 
              
            
!

CSS

              
                body {background:#fff;}
#lightrope {
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  position: fixed;
  z-index: 1000;
  margin: -15px 0 0 0;
  padding: 0;
  pointer-events: none;
  width: 100%;
}
#lightrope li {
	transform-origin: top-center;
	border-left:2px solid rgba(0,0,0,.05);
	border-right:2px solid rgba(255,255,255,.5);
  position: relative;
  -webkit-animation-fill-mode: both;
          animation-fill-mode: both;
  -webkit-animation-iteration-count: infinite;
          animation-iteration-count: infinite;
  list-style: none;
  margin: 0;
  padding: 0;
  display: block;
  width: 8px; /* orig 12px */
  height: 18px; /* orig 28px */
  border-radius: 50%;
  margin: 20px 20px 20px 22px;
  display: inline-block;

          animation-duration: 2s;
}
#lightrope li:nth-child(5n+0) { 
  background: aqua;
  box-shadow: 0px 4.6666666667px 24px 3px rgba(0, 255, 255, 0.5);
  -webkit-animation-duration: 0.8s; 
          animation-duration: 0.8s;
}
#lightrope li:nth-child(5n+1) {
  background: #f70094;
  box-shadow: 0px 4.6666666667px 24px 3px #f70094;
  -webkit-animation-duration: .9s; 
          animation-duration: .9s;
}
#lightrope li:nth-child(5n+2) { 
	 background: yellow;
  box-shadow: 0px 4.6666666667px 24px 3px yellow;
  -webkit-animation-duration: 1s;
          animation-duration: 1s;
}
#lightrope li:nth-child(5n+3) { 
	 background: pink;
  box-shadow: 0px 4.6666666667px 24px 3px pink ;
  -webkit-animation-duration: 1.1s;
          animation-duration: 1.1s;
}
#lightrope li:nth-child(5n+4) { 
		 background: orange;
  box-shadow: 0px 4.6666666667px 24px 3px orange ;
  -webkit-animation-duration: 1.2s; 
          animation-duration: 1.2s;
}

#lightrope li:nth-child(4n+0) {
    -webkit-animation-name: flash-1, sway;
    animation-name: flash-1, sway;
    -webkit-animation-duration: inherit, 4.9s;
    animation-duration: inherit, 4.9s;
    -webkit-animation-timing-function: inherit, ease-in-out;
    animation-timing-function: inherit, ease-in-out;
}

#lightrope li:nth-child(4n+1) {
    -webkit-animation-name: flash-2, sway;
    animation-name: flash-2, sway;
    -webkit-animation-duration: inherit, 4.1s;
    animation-duration: inherit, 4.1s;
    -webkit-animation-timing-function: inherit, ease-in-out;
    animation-timing-function: inherit, ease-in-out;
}

#lightrope li:nth-child(4n+2) {
    -webkit-animation-name: flash-3, sway;
    animation-name: flash-3, sway;
    -webkit-animation-duration: inherit, 4.3s;
    animation-duration: inherit, 4.3s;
    -webkit-animation-timing-function: inherit, ease-in-out;
    animation-timing-function: inherit, ease-in-out;
}

#lightrope li:nth-child(4n+3) {
    -webkit-animation-name: flash-4, sway;
    animation-name: flash-4, sway;
    -webkit-animation-duration: inherit, 4.5s;
    animation-duration: inherit, 4.5s;
    -webkit-animation-timing-function: inherit, ease-in-out;
    animation-timing-function: inherit, ease-in-out;
}


#lightrope > li.broken { 
  left: -2px;
		 background: #CCC; 
	border-left:2px solid #BDE;
	border-right:2px solid #DEF;
  box-shadow: none !important ;
	-webkit-animation-name:  none !important ;
          animation-name:  none !important ;
  -webkit-animation-duration: 0 !important; 
          animation-duration: 0 !Important;
	
	transform: rotatez(15deg);
}
#lightrope > li.broken::after {
	transform: rotatez(-15deg) translatey(-7px) !important;
}

#lightrope > li:before {
  content: "";
  position: absolute;
  background: #262;
  width: 5px;
  height: 8px;
  border-radius: 3px;
  top: -4.6666666667px;
  left: -1px;
		border-left:2px solid rgba(0,0,0,.05);
	border-right:2px solid rgba(255,255,255,.5);

}
#lightrope > li::after {
  content: "";
  top: -12px; /*14px for non-wavy original */
  left: -1px;
  position: absolute;
  width: 58px;
  height: 18.6666666667px;
  border-bottom: solid #262 2px;
  border-radius: 50%;

  
	

background:#060;
	/* wavy cord: courtesy https://css-generators.com/wavy-shapes/ */
  --mask:
    radial-gradient(5.66px at 50% calc(100% + 4.2px),#0000 calc(99% - 1px),#000 calc(101% - 1px) 99%,#0000 101%) calc(50% - 6px) calc(50% - 2px + .5px)/12px 4px repeat-x, radial-gradient(5.66px at 50% -4.2px,#0000 calc(99% - 1px),#000 calc(101% - 1px) 99%,#0000 101%) 50% calc(50% + 2px)/12px 4px repeat-x, radial-gradient(7.38px at 50% calc(100% + 5.6px),#0000 calc(99% - 1px),#000 calc(101% - 1px) 99%,#0000 101%) calc(50% - 8px) calc(50% - 2.5px + .5px)/16px 5px repeat-x, radial-gradient(7.38px at 50% -5.6px,#0000 calc(99% - 1px),#000 calc(101% - 1px) 99%,#0000 101%) 50% calc(50% + 2.5px)/16px 5px repeat-x;
  -webkit-mask: var(--mask);
          mask: var(--mask);


}
#lightrope li:last-child:after {
  content: none;
}
#lightrope li:first-child {
  margin-left: -40px;
}

@-webkit-keyframes flash-1 {
  0%, 100% {
    background: #00f7a5;
    box-shadow: 0px 4.6666666667px 24px 3px #00f7a5;
  }
  50% {
    background: rgba(0, 247, 165, 0.4);
    box-shadow: 0px 4.6666666667px 24px 3px rgba(0, 247, 165, 0.2);
  }
}

@keyframes flash-1 {
  0%, 100% {
    background: #00f7a5;
    box-shadow: 0px 4.6666666667px 24px 3px #00f7a5;
  }
  50% {
    background: rgba(0, 247, 165, 0.4);
    box-shadow: 0px 4.6666666667px 24px 3px rgba(0, 247, 165, 0.2);
  }
}
@-webkit-keyframes flash-2 {
  0%, 100% {
    background: #0CF;
    box-shadow: 0px 4.6666666667px 24px 3px #0CF;
  }
  50% {
    background: rgba(0, 255, 255, 0.4);
    box-shadow: 0px 4.6666666667px 24px 3px rgba(0, 255, 255, 0.2);
  }
}
@keyframes flash-2 {
  0%, 100% {
    background: #0CF;
    box-shadow: 0px 4.6666666667px 24px 3px #0CF;
  }
  50% {
    background: rgba(0, 255, 255, 0.4);
    box-shadow: 0px 4.6666666667px 24px 3px rgba(0, 255, 255, 0.2);
  }
}
@-webkit-keyframes flash-3 {
  0%, 100% {
    background: #f76666; 
    box-shadow: 0px 4.6666666667px 24px 3px #f76666;
  }
  50% {
    background: rgba(247, 0, 148, 0.4);
    box-shadow: 0px 4.6666666667px 24px 3px rgba(247, 0, 148, 0.2);
  }
}
@keyframes flash-3 {
  0%, 100% {
    background: #f76666;
    box-shadow: 0px 4.6666666667px 24px 3px #f76666;
  }
  50% {
    background: rgba(247, 0, 148, 0.4);
    box-shadow: 0px 4.6666666667px 24px 3px rgba(247, 0, 148, 0.2);
  }
}
@-webkit-keyframes flash-4 {
  0%, 100% {
    background: #FFEE33;
    box-shadow: 0px 4.6666666667px 24px 3px #FFEE33;
  }
  50% {
    background: rgba(247,247,0, 0.4);
    box-shadow: 0px 4.6666666667px 24px 3px rgba(247,247,0,0.2);
  }
}
@keyframes flash-4 {
  0%, 100% {
    background: #FFEE33;
    box-shadow: 0px 4.6666666667px 24px 3px #FFEE33;
  }
  50% {
    background: rgba(247,247,0, 0.4);
    box-shadow: 0px 4.6666666667px 24px 3px rgba(247,247,0, 0.2);
  }
}



@-webkit-keyframes sway {
    0%, 100% {
        transform: rotate(.5deg);
    }
    50% {
        transform: rotate(-.5deg);
    }
}

@keyframes sway {
    0%, 100% {
        transform: rotate(.5deg);
    }
    50% {
        transform: rotate(-.5deg);
    }
}
              
            
!

JS

              
                // original demo:
// https://codepen.io/tobyj/pen/QjvEex
              
            
!
999px

Console