.stack {
	margin: 20px auto;
	width: 400px;
	padding: 0;
	position: relative;
	max-width: 100%;
}

.stack img {
	max-width: 100%;
	position: absolute;
	top: 0;
	left: 0;
	-webkit-transition: all 0.3s;
	transition: all 0.3s;
	outline: 1px solid transparent;
}

.stack img:last-child {
	position: relative;
}

/* Individual effects */

/* Simple Spread */
.stack-spread.active img:nth-child(3) {
	-webkit-transform: translate(-15px,15px);
	transform: translate(-15px,15px);
}

.stack-spread.active img:first-child {
	-webkit-transform: translate(15px,-15px);
	transform: translate(15px,-15px);
}

/* Fan out */
.stack-fanout img:first-child,
.stack-fanout img:nth-child(2) {
	-webkit-transform: scale(0.8);
	transform: scale(0.8);
}

.stack-fanout.active img:nth-child(3) {
	-webkit-transform: scale(0.9);
	transform: scale(0.9);
}

.stack-fanout.active img:first-child {
	-webkit-transform: rotate(-10deg) translateX(-25%) scale(0.8);
	transform: rotate(-10deg) translateX(-25%) scale(0.8);
}

.stack-fanout.active img:nth-child(2) {
	-webkit-transform: rotate(10deg) translateX(25%) scale(0.8);
	transform: rotate(10deg) translateX(25%) scale(0.8);
}

/* Random rotation */
.stack-randomrot.active img:nth-child(3) {
	-webkit-transform: translate(15px,15px);
	transform: translate(15px,15px);
}

.stack-randomrot.active img:first-child {
	-webkit-transform: rotate(-10deg);
	transform: rotate(-10deg);
}

.stack-randomrot.active img:nth-child(2) {
	-webkit-transform: rotate(10deg);
	transform: rotate(10deg);
}

/* Side slide */
.stack-sideslide img:first-child,
.stack-sideslide img:nth-child(2) {
	visibility: hidden;
	opacity: 0;
	-webkit-transition: -webkit-transform 0.3s, opacity 0.3s, visibility 0s 0.3s;
	transition: transform 0.3s, opacity 0.3s, visibility 0s 0.3s;
}

.stack-sideslide img:first-child {
	-webkit-transform: translateX(-50%) scale(0.6);
	transform: translateX(-50%) scale(0.6);
}

.stack-sideslide img:nth-child(2) {
	-webkit-transform: translateX(50%) scale(0.6);
	transform: translateX(50%) scale(0.6);
}

.stack-sideslide.active img:nth-child(3) {
	-webkit-transform: scale(0.9);
	transform: scale(0.9);
}

.stack-sideslide.active img:first-child,
.stack-sideslide.active img:nth-child(2) {
	opacity: 1;
	visibility: visible;
	-webkit-transition: -webkit-transform 0.5s, opacity 0.5s;
	transition: transform 0.5s, opacity 0.5s;
}

.stack-sideslide.active img:first-child {
	-webkit-transform: translateX(-20%) scale(0.8);
	transform: translateX(-20%) scale(0.8);
}

.stack-sideslide.active img:nth-child(2) {
	-webkit-transform: translateX(20%) scale(0.8);
	transform: translateX(20%) scale(0.8);
}

/* Side Grid */
.stack-sidegrid img:first-child,
.stack-sidegrid img:nth-child(2),
.stack-sidegrid img:nth-child(3) {
	-webkit-transform: scale(0);
	transform: scale(0);
}

.stack-sidegrid img:nth-child(4) {
	-webkit-transform-origin: 0 0;
	transform-origin: 0 0;
}

.stack-sidegrid img:nth-child(3) {
	-webkit-transform-origin: 100% 0;
	transform-origin: 100% 0;
}

.stack-sidegrid img:nth-child(2) {
	-webkit-transform-origin: 0 100%;
	transform-origin: 0 100%;
}

.stack-sidegrid img:first-child {
	-webkit-transform-origin: 100% 100%;
	transform-origin: 100% 100%;
}

.stack-sidegrid.active img {
	-webkit-transform: scale(0.48);
	transform: scale(0.48);
}

/* Bouncy Grid */
.stack-bouncygrid.active img {
	-webkit-transform: scale(0.48);
	transform: scale(0.48);
}

.stack-bouncygrid.active img:nth-child(4) {
	-webkit-transform-origin: 0 0;
	transform-origin: 0 0;
}

.stack-bouncygrid.active img:nth-child(3) {
	-webkit-transform-origin: 100% 0;
	transform-origin: 100% 0;
}

.stack-bouncygrid.active img:nth-child(2) {
	-webkit-transform-origin: 0 100%;
	transform-origin: 0 100%;
}

.stack-bouncygrid.active img:first-child {
	-webkit-transform-origin: 100% 100%;
	transform-origin: 100% 100%;
}

/* Peek-a-boo */
.stack-peekaboo img:first-child,
.stack-peekaboo img:nth-child(2),
.stack-peekaboo img:nth-child(3) {
	-webkit-transform: scale(0.5);
	transform: scale(0.5);
}

.stack-peekaboo.active img:nth-child(3) {
	-webkit-transform: scale(0.5) translate(-50%,-50%) rotate(-15deg);
	transform: scale(0.5) translate(-50%,-50%) rotate(-15deg);
}

.stack-peekaboo.active img:first-child {
	-webkit-transform: scale(0.5) translate(50%,-50%) rotate(15deg);
	transform: scale(0.5) translate(50%,-50%) rotate(15deg);
}

.stack-peekaboo.active img:nth-child(2) {
	-webkit-transform: scale(0.5) translate(0,-50%);
	transform: scale(0.5) translate(0,-50%);
}

.stack-peekaboo img:nth-child(4) {
	-webkit-transform-origin: 50% 100%;
	transform-origin: 50% 100%;
}

.stack-peekaboo.active img:nth-child(4) {
	-webkit-transform: scale(0.9);
	transform: scale(0.9);
}

/* Preview Grid */
.stack-previewgrid img:first-child,
.stack-previewgrid img:nth-child(2),
.stack-previewgrid img:nth-child(3) { /* you'd use smaller images here and not define the width like this */
	width: 24.5%;
	top: auto;
	left: auto;
	bottom: 0;
	-webkit-transform: scale(0);
	transform: scale(0);
}

.stack-previewgrid img:first-child {
	right: 12.5%;
}

.stack-previewgrid img:nth-child(2) {
	left: 37.75%;
}

.stack-previewgrid img:nth-child(3) {
	left: 12.5%;
}

.stack-previewgrid.active img:first-child,
.stack-previewgrid.active img:nth-child(2),
.stack-previewgrid.active img:nth-child(3) {
	-webkit-transform: scale(1);
	transform: scale(1);
}

.stack-previewgrid img:nth-child(4) {
	-webkit-transform-origin: 50% -1.5%;
	transform-origin: 50% -1.5%;
}

.stack-previewgrid.active img:nth-child(4) {
	-webkit-transform: scale(0.75);
	transform: scale(0.75);
}

/* Corner grid */
.stack-cornergrid img:first-child,
.stack-cornergrid img:nth-child(2),
.stack-cornergrid img:nth-child(3) {
	-webkit-transform-origin: 100% 100%;
	transform-origin: 100% 100%;
	-webkit-transform: scale(0.5);
	transform: scale(0.5);
}

.stack-cornergrid.active img:nth-child(3) {
	-webkit-transform: scale(0.5) translate(-100%,0%);
	transform: scale(0.5) translate(-100%,0%);
}

.stack-cornergrid.active img:nth-child(2) {
	-webkit-transform: scale(0.5) translate(-100%,-100%);
	transform: scale(0.5) translate(-100%,-100%);
}

.stack-cornergrid.active img:first-child {
	-webkit-transform: scale(0.5) translate(0%,-100%);
	transform: scale(0.5) translate(0%,-100%);
}

.stack-cornergrid img:nth-child(4) {
	-webkit-transform-origin: 100% 100%;
	transform-origin: 100% 100%;
}

.stack-cornergrid.active img:nth-child(4) {
	-webkit-transform: scale(0.5);
	transform: scale(0.5);
}

/* Coverflow */
.stack-coverflow {
	-webkit-perspective: 1600px;
	perspective: 1600px;
}

.stack-coverflow img { /* fixes Chrome 35.0.1916.114 issue (snaps back to translated state) */
	-webkit-transform: translateZ(0) translateX(0) rotateY(0);
	transform: translateZ(0) translateX(0) rotateY(0);
}

.stack-coverflow.active img:nth-child(3) {
	-webkit-transform: translateZ(-300px) translateX(-20%) rotateY(-45deg);
	transform: translateZ(-300px) translateX(-20%) rotateY(-45deg);
}

.stack-coverflow.active img:first-child {
	-webkit-transform: translateZ(-300px) translateX(20%) rotateY(-45deg);
	transform: translateZ(-300px) translateX(20%) rotateY(-45deg);
}

.stack-coverflow.active img:nth-child(2) {
	-webkit-transform: translateZ(-300px) rotateY(-45deg);
	transform: translateZ(-300px) rotateY(-45deg);
}

/* leaflet */
.stack-leaflet {
	-webkit-perspective: 1600px;
	perspective: 1600px;
}

.stack-leaflet img {
	-webkit-transform-origin: 50% 0;
	transform-origin: 50% 0;
}

.stack-leaflet.active img:nth-child(4) {
	-webkit-transform: rotateX(45deg);
	transform: rotateX(45deg);
}

.stack-leaflet.active img:nth-child(2) {
	-webkit-transform: rotateX(25deg);
	transform: rotateX(25deg);
	-webkit-transition-delay: .1s;
	transition-delay: .1s;
}

.stack-leaflet.active img:nth-child(3) {
	-webkit-transform: rotateX(35deg);
	transform: rotateX(35deg);
	-webkit-transition-delay: .05s;
	transition-delay: .05s;
}

/* Vertical Spread */
.stack-vertspread.active img:nth-child(4) {
	-webkit-transform: translateY(75px);
	transform: translateY(75px);
}

.stack-vertspread.active img:nth-child(3) {
	-webkit-transform: translateY(50px);
	transform: translateY(50px);
	-webkit-transition-delay: .1s;
	transition-delay: .1s;
}

.stack-vertspread.active img:nth-child(2) {
	-webkit-transform: translateY(25px);
	transform: translateY(25px);
	-webkit-transition-delay: .2s;
	transition-delay: .2s;
}

/* Vertical Elastic Spread */
.stack-vertelastic img {
	-webkit-transition: all 0.2s ease-in;
	transition: all 0.2s ease-in;
}

.stack-vertelastic.active img {
	-webkit-transition-duration: 0.3s;
	transition-duration: 0.3s;
	-webkit-transition-timing-function: cubic-bezier(0.175, 0.885, 0.470, 1); /* older webkit */
	-webkit-transition-timing-function: cubic-bezier(0.175, 0.885, 0.470, 1.515);
	transition-timing-function: cubic-bezier(0.175, 0.885, 0.470, 1.515);
}

.stack-vertelastic.active img:nth-child(4) {
	-webkit-transform: translateY(90px);
	transform: translateY(90px);
}

.stack-vertelastic.active img:nth-child(2) {
	-webkit-transform: translateY(20px);
	transform: translateY(20px);
}

.stack-vertelastic.active img:nth-child(3) {
	-webkit-transform: translateY(50px);
	transform: translateY(50px);
}

/* Fan */
.stack-fan img {
	-webkit-transform-origin: 0 0%;
	transform-origin: 0 0%;
}

.stack-fan.active img:nth-child(4) {
	-webkit-transform: rotate(15deg);
	transform: rotate(15deg);
}

.stack-fan.active img:nth-child(2) {
	-webkit-transform: rotate(5deg);
	transform: rotate(5deg);
	-webkit-transition-delay: .1s;
	transition-delay: .1s;
}

.stack-fan.active img:nth-child(3) {
	-webkit-transform: rotate(10deg);
	transform: rotate(10deg);
	-webkit-transition-delay: .05s;
	transition-delay: .05s;
}

/* Queue */
.stack-queue {
	-webkit-transition: all 0.3s;
	transition: all 0.3s;
}

.stack-queue.active {
	-webkit-transform: scale(0.9);
	transform: scale(0.9);
}

.stack-queue img {
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
	-webkit-transform-origin: 50% -50%;
	transform-origin: 50% -50%;
}

.stack-queue.active img:first-child {
	-webkit-transform: scale(.7);
	transform: scale(.7);
}

.stack-queue.active img:nth-child(2) {
	-webkit-transform: scale(.8);
	transform: scale(.8);
}

.stack-queue.active img:nth-child(3) {
	-webkit-transform: scale(.9);
	transform: scale(.9);
}

