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


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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


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.


                <div id="imgdex">
    <img src="" alt="Photograph of a woman's face under a Bedouin headress"><figcaption>Bedouin</figcaption>
    <img src="" alt="Photograph of a man's blue-green-eyes"><figcaption>Blue-green</figcaption>
    <img src="" alt="Photograph of dramatic fake eyelashes in closeup">
    <figcaption>Dramatic Fake</figcaption>
    <img src="" alt="Photograph of a girl in heavy snow"><figcaption>Snow</figcaption>
<input type="range" min="1" onfocus="this.oldvalue = this.value;" oninput="updateImage(this);this.oldvalue = this.value;" id="ranger">


                #imgdex { 
  position: relative;
  perspective: 4000px;
  width: 80%;
  max-width: 1200px;
  margin: 0 auto;
  transform-style: preserve-3d;
  font-family: Avenir, Calibri, sans-serif;
  padding-top: 48%;
#imgdex figure,
  #imgdex figure figcaption { 
    position: absolute;
    transition: 1s ease-in-out;
#imgdex figure {
  top: 0; left: 120px;
  transform-origin: left bottom;
  width: 70%;
#imgdex figure img {
  width: 100%;
#imgdex figure figcaption { 
  bottom: 0; 
  font-size: 1.2rem;
  left: -8rem;
  opacity: 0;
#imgdex figure:last-of-type{ 
  transform: rotateX(5deg);
  box-shadow: 0px 0px 200px rgba(0,0,0,0.5);
form { 
  text-align: center; 
  padding-bottom: 2rem;

form input[type="range"] { 
  width: 50%;


                var imgdex = document.getElementById('imgdex'),
figs = imgdex.querySelectorAll('figure'),
imgcount = figs.length;
ranger.max = imgcount;
ranger.value = imgcount;
for(var i=0;i<(imgcount-1);i++) {
	var rotation = parseFloat(-92 + "." + (imgcount - i));
	figs[i].style.transform = 'rotateX(' + rotation + 'deg)';
document.querySelector('#imgdex figure:last-child figcaption').style.opacity = 1;

function updateImage(slider) {
	var currentimg = document.querySelector('#imgdex figure:nth-child('+slider.value+')');
	if (slider.oldvalue !== undefined) {
		var oldimg = document.querySelector('#imgdex figure:nth-child('+(slider.oldvalue)+')');
	} else {
		slider.oldvalue = imgcount;
		var oldimg = document.querySelector('#imgdex figure:nth-child('+(slider.oldvalue)+')');
	if (slider.value < slider.oldvalue) { 
		// going forwards = 'rotateX('+slider.value+'deg)';
	if (slider.value > slider.oldvalue) {
		// going backwards
		var rotation = parseFloat(-92 + "." + (imgcount - slider.value)); = 'rotateX(' + rotation + 'deg)';
   if (slider.value !== slider.oldvalue) {
	   currentimg.querySelector('figcaption').style.opacity = 1;
	   oldimg.querySelector('figcaption').style.opacity = 0;