Pen Settings

HTML

CSS

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

JavaScript

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

Behavior

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.

HTML

              
                //- .page
//- 	.card
//- 		.card-inner
//- 			.card-front
//- 				.hero-name
//- 					h2.hero-name_front Batman
//- 					h5.alt-name_front Bruce Wayne
//- 			.card-back
//- 				.hero-details_back
//- 					p A wealthy socialite, and the owner of Wayne Enterprises. He dedicates himself to protecting Gotham City from its criminal underworld as a highly trained, masked vigilante equipped with various tools and weapons.
//- 				h1.hero-name_back Batman
//- 				.alt-details-list
//- 					h2.alt-details_name Bruce Wayne
//- 					h2.alt-details_group Justice League
					
.page.js-card
              
            
!

CSS

              
                .page{
	align-items: center;
	background: radial-gradient(#000, #222);
	display: flex;
	flex-wrap: wrap;
	height: 100%;
	justify-content: center;
	min-height: 100vh;
}

.card {
  background: linear-gradient(rgba(#fff, .02), rgba(#fff, .075));
	border: 1px solid #333;
	font: 400 12px/1em sans-serif;
  height: 28em;
	margin: 2em;
	padding: 2em;
  perspective: 75em;
  width: 20em;
	
	*{
		box-sizing: border-box;
		margin: 0;
		padding: 0;
	}
	
	&:nth-child(1)>&-inner>&-front{
		background: linear-gradient(-8deg, #222, #000 5em, rgba(red, 0) 5em, rgba(red, 0)) no-repeat, url(https://armchairmogul.files.wordpress.com/2011/07/supes.jpg) center/cover no-repeat;
	}

	&:nth-child(2)>&-inner>&-front{
		background: linear-gradient(-8deg, #222, #000 5em, rgba(red, 0) 5em, rgba(red, 0)) no-repeat, url(https://imgix.ranker.com/user_node_img/42/822905/original/david-finch-writers-photo-u4?w=650&q=50&fm=pjpg&fit=crop&crop=faces) center/cover no-repeat;
	}

	&:nth-child(3)>&-inner>&-front{
		background: linear-gradient(-8deg, #222, #000 5em, rgba(red, 0) 5em, rgba(red, 0)) no-repeat, url(https://cdn1.thr.com/sites/default/files/imagecache/NFE_portrait/2018/08/wonder_woman_58_-_publicity_-_p_2018.jpg) center/cover no-repeat;
	}

	&:nth-child(4)>&-inner>&-front{
		background: linear-gradient(-8deg, #222, #000 5em, rgba(red, 0) 5em, rgba(red, 0)) no-repeat, url(https://cdn11.bigcommerce.com/s-0kvv9/images/stencil/1280x1280/products/272820/381201/jul180644__14403.1537997529.jpg?c=2&imbypass=on) center/cover no-repeat;
	}

	&:nth-child(5)>&-inner>&-front{
		background: linear-gradient(-8deg, #222, #000 5em, rgba(red, 0) 5em, rgba(red, 0)) no-repeat, url(https://i.pinimg.com/originals/a9/52/58/a9525813f9beddc4a1818d87b8d4c963.jpg) center/cover no-repeat;
	}

	&:nth-child(6)>&-inner>&-front{
		background: linear-gradient(-8deg, #222, #000 5em, rgba(red, 0) 5em, rgba(red, 0)) no-repeat, url(https://i.pinimg.com/originals/a2/78/12/a2781277d54f3fd21f7194860bf708be.jpg) center/cover no-repeat;
	}

	&:nth-child(7)>&-inner>&-front{
		background: linear-gradient(-8deg, #222, #000 5em, rgba(red, 0) 5em, rgba(red, 0)) no-repeat, url(https://i.pinimg.com/originals/6e/7c/48/6e7c481f7750f3f285ff3f58b87dd686.jpg) center/cover no-repeat;
	}
	
	&:nth-child(1)>&-inner>&-back{
		background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/159363/NicePng_dc-comics-logo-png_832568.png) .75em .75em/20% no-repeat, linear-gradient(rgba(#0179ef, 0),rgba(#0179ef, 0) 23.25em, rgba(#fff, .85) 23.25em, rgba(#fff, .85)) no-repeat, linear-gradient(-90deg, rgba(#0179ef, 1) 5em, rgba(#0179ef, 0)) no-repeat, url(https://armchairmogul.files.wordpress.com/2011/07/supes.jpg) center/cover no-repeat;
	}

	&:nth-child(2)>&-inner>&-back{
		background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/159363/NicePng_dc-comics-logo-png_832568.png) .75em .75em/20% no-repeat, linear-gradient(rgba(#0179ef, 0),rgba(#0179ef, 0) 23.25em, rgba(#fff, .85) 23.25em, rgba(#fff, .85)) no-repeat, linear-gradient(-90deg, rgba(#0179ef, 1) 5em, rgba(#0179ef, 0)) no-repeat, url(https://imgix.ranker.com/user_node_img/42/822905/original/david-finch-writers-photo-u4?w=650&q=50&fm=pjpg&fit=crop&crop=faces) center/cover no-repeat;
	}

	&:nth-child(3)>&-inner>&-back{
		background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/159363/NicePng_dc-comics-logo-png_832568.png) .75em .75em/20% no-repeat, linear-gradient(rgba(#0179ef, 0),rgba(#0179ef, 0) 23.25em, rgba(#fff, .85) 23.25em, rgba(#fff, .85)) no-repeat, linear-gradient(-90deg, rgba(#0179ef, 1) 5em, rgba(#0179ef, 0)) no-repeat, url(https://cdn1.thr.com/sites/default/files/imagecache/NFE_portrait/2018/08/wonder_woman_58_-_publicity_-_p_2018.jpg) center/cover no-repeat;
	}

	&:nth-child(4)>&-inner>&-back{
		background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/159363/NicePng_dc-comics-logo-png_832568.png) .75em .75em/20% no-repeat, linear-gradient(rgba(#0179ef, 0),rgba(#0179ef, 0) 23.25em, rgba(#fff, .85) 23.25em, rgba(#fff, .85)) no-repeat, linear-gradient(-90deg, rgba(#0179ef, 1) 5em, rgba(#0179ef, 0)) no-repeat, url(https://cdn11.bigcommerce.com/s-0kvv9/images/stencil/1280x1280/products/272820/381201/jul180644__14403.1537997529.jpg?c=2&imbypass=on) center/cover no-repeat;
	}

	&:nth-child(5)>&-inner>&-back{
		background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/159363/NicePng_dc-comics-logo-png_832568.png) .75em .75em/20% no-repeat, linear-gradient(rgba(#0179ef, 0),rgba(#0179ef, 0) 23.25em, rgba(#fff, .85) 23.25em, rgba(#fff, .85)) no-repeat, linear-gradient(-90deg, rgba(#0179ef, 1) 5em, rgba(#0179ef, 0)) no-repeat, url(https://i.pinimg.com/originals/a9/52/58/a9525813f9beddc4a1818d87b8d4c963.jpg) center/cover no-repeat;
	}

	&:nth-child(6)>&-inner>&-back{
		background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/159363/NicePng_dc-comics-logo-png_832568.png) .75em .75em/20% no-repeat, linear-gradient(rgba(#0179ef, 0),rgba(#0179ef, 0) 23.25em, rgba(#fff, .85) 23.25em, rgba(#fff, .85)) no-repeat, linear-gradient(-90deg, rgba(#0179ef, 1) 5em, rgba(#0179ef, 0)) no-repeat, url(https://i.pinimg.com/originals/a2/78/12/a2781277d54f3fd21f7194860bf708be.jpg) center/cover no-repeat;
	}

	&:nth-child(7)>&-inner>&-back{
		background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/159363/NicePng_dc-comics-logo-png_832568.png) .75em .75em/20% no-repeat, linear-gradient(rgba(#0179ef, 0),rgba(#0179ef, 0) 23.25em, rgba(#fff, .85) 23.25em, rgba(#fff, .85)) no-repeat, linear-gradient(-90deg, rgba(#0179ef, 1) 5em, rgba(#0179ef, 0)) no-repeat, url(https://i.pinimg.com/originals/6e/7c/48/6e7c481f7750f3f285ff3f58b87dd686.jpg) center/cover no-repeat;
	}
	
	&-inner {
		height: 100%;
		max-width: 20em;
		position: relative;
		transform-style: preserve-3d;
		transition: transform 0.8s;
		width: 100%;
	}
	
	&:hover &-inner {
		transform: rotateY(-180deg);
	}
	
	&-front, &-back {
		backface-visibility: hidden;
		display: grid;
		height: 100%;
		max-width: 20em;
		overflow: hidden;
		position: absolute;
		width: 100%;
		z-index: 1;
	}
	
	&-front {
		background: linear-gradient(-8deg, #333, #000 5em, rgba(red, 0) 5em, rgba(red, 0)) no-repeat, url(https://armchairmogul.files.wordpress.com/2011/07/supes.jpg) center/cover no-repeat;
		color: black;
		grid-template-columns: 1fr 6.875em;
		grid-template-rows: 1fr 3.125em;
		
		
		&:before{
			border: .125em dotted #fff;
			content:"";
			height: 125%;
			position: absolute;
			top: -10%;
			right: 8%;
			width: 125%;
		}
		
		&:after{
			background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/159363/NicePng_dc-comics-logo-png_832568.png) center 1.5em/75% no-repeat, linear-gradient(-8deg, darken(#0179ef, 25), #0179ef 5.625em, rgba(#0179ef, 0) 5.625em, rgba(#0179ef, 0)) no-repeat;
			content: '';
			width: 5em;
			height: 6.25em;
			bottom: 0;
			right: .625em;
			position: absolute;
		}
	}

	&-back {
		background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/159363/NicePng_dc-comics-logo-png_832568.png) .75em .75em/20% no-repeat, linear-gradient(rgba(#0179ef, 0),rgba(#0179ef, 0) 23.25em, rgba(#fff, .85) 23.25em, rgba(#fff, .85)) no-repeat, linear-gradient(-90deg, rgba(#0179ef, 1) 5em, rgba(#0179ef, 0)) no-repeat, url(https://imgix.ranker.com/user_node_img/42/822905/original/david-finch-writers-photo-u4?w=650&q=50&fm=pjpg&fit=crop&crop=faces) center/cover no-repeat;
		color: white;
		grid-template-columns: 1fr 8em;
		grid-template-rows: 1fr 12em 2em 5em;
		transform: rotateY(180deg);
	}
}

.hero{
	&-details_back{
		background: linear-gradient(#000, #333);
		grid-column: 2 / 3;
		grid-row: 2/5;
		
		p{
			font-size: .7em;
			font-weight: 400;
			line-height: 1.4em;
			padding: .75em;
		}
	}
	
	&-name{
		grid-row: 2 / 3;
		
		&_front{
			color: #fff;
			font-size: 1.5em;
			text-align: right;
			text-transform: uppercase;
		}
		
		&_back{
			font-size: 2em;
			grid-column: 1/3;
			grid-row: 3/4;
			padding: 0 .25em;
			text-align: right;
			text-shadow: 0px 3px 1px #111;
			text-transform: uppercase;
		}
	}
}

.alt{
	&-name{
		
		&_front{
			color: #fff;
			font-weight: 400;
			margin-top: .5em;
			text-align: right;
			text-transform: uppercase;
		}
	}
	
	&-details{
		
		&-list{
			grid-column: 2/3;
			grid-row: 4/5;
		}
		
		&_name, &_group{
			font-size: .65em;
			font-weight: 600;
			margin-bottom: 1em;
			padding-left: .5em;
			text-transform: uppercase;
			
			&:before{
				content:'name';
				display: block;
				font-size: .9em;
				font-weight: 400;
				line-height: 1em;
				text-transform: none;
			}
		}
		
		&_name:before{
			content: 'Real Name'
		}
		
		&_group:before{
			content: 'Group Affiliation'
		}
	}
}
              
            
!

JS

              
                var dcCards = document.querySelector(".js-card");

var heroName = [
	"Superman",
	"Batman",
	"Wonderwoman",
	"Flash",
	"Green Lantern",
	"Aquaman",
	"Cyborg"
];

var altName = [
	"Kal-El / Clark Kent",
	"Bruce Wayne",
	"Diana Prince",
	"Barry Allen",
	"Hal Jordan",
	"Arthur Curry",
	"Victor Stone"
];

var groupAffiliation = [
	"Justice League",
	"Justice League",
	"Justice League",
	"Justice League",
	"Justice League",
	"Justice League",
	"Justice League"
];

var comicArt = [
	"https://armchairmogul.files.wordpress.com/2011/07/supes.jpg",
	"https://imgix.ranker.com/user_node_img/42/822905/original/david-finch-writers-photo-u4?w=650&q=50&fm=pjpg&fit=crop&crop=faces",
	"https://cdn1.thr.com/sites/default/files/imagecache/NFE_portrait/2018/08/wonder_woman_58_-_publicity_-_p_2018.jpg",
	"https://cdn11.bigcommerce.com/s-0kvv9/images/stencil/1280x1280/products/272820/381201/jul180644__14403.1537997529.jpg?c=2&imbypass=on",
	"https://i.pinimg.com/originals/a9/52/58/a9525813f9beddc4a1818d87b8d4c963.jpg",
	"https://i.pinimg.com/originals/a2/78/12/a2781277d54f3fd21f7194860bf708be.jpg",
	"https://i.pinimg.com/originals/6e/7c/48/6e7c481f7750f3f285ff3f58b87dd686.jpg"
];

var heroDetails = [
	"A member of, and inspiration for, the Justice League. He is a Kryptonian survivor, and a journalist for the Daily Planet based in Metropolis.",
	"A wealthy socialite, and the owner of Wayne Enterprises. He dedicates himself to protecting Gotham City from its criminal underworld as a highly trained, masked vigilante equipped with various tools and weapons.",
	"An antiquities dealer and an immortal Amazonian warrior, who is the crown princess of Themyscira. She is endowed with metahuman attributes and abilities inherited from her parents.",
	"A Central City University student, who can move at superhuman speeds with his ability to tap into the Speed Force.",
	"Green Lantern",
	"The heir to the throne of the undersea nation of Atlantis.[11] His metahuman aquatic abilities and physical attributes originate from his Atlantean physiology.",
	"A former college athlete who, after being cybernetically reconstructed after a nearly fatal car accident, is turned into a techno-organic being enhanced by reactive, adaptive biomimetic alien technology."
];

var comicCard = "";
for (i = 0; i < heroName.length; i++) {
	comicCard +=
		"<div class='card'><div class='card-inner'><div class='card-front'><div class='hero-name'><h2 class='hero-name_front'>" +
		heroName[i] +
		"</h2><h5 class='alt-name_front'>" +
		altName[i] +
		"</h5></div></div><div class='card-back'><div class='hero-details_back'><p>" +
		heroDetails[i] +
		"</p></div><h1 class='hero-name_back'>" +
		heroName[i] +
		"</h1><div class='alt-details-list'><h2 class='alt-details_name'>" +
		altName[i] +
		"</h2><h2 class='alt-details_group'>" +
		groupAffiliation[i] +
		"</h2></div></div></div></div>";
}

dcCards.insertAdjacentHTML("beforeend", comicCard);

              
            
!
999px

Console