cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

            
              <section id="sect">
	<article id="book">
		<div class="viewport">
			<div class="page p1">
				<h1>Book in CSS3</h1>
				<p>Hover/click me to take a look inside</p>
			</div>
			<div class="page p2">
				<h1>Headline for a book</h1>
				<p>Itaque magni similique consequuntur distinctio temporibus expedita dolore repellat quibusdam ipsum quos explicabo, tempora deserunt pariatur, sit animi incidunt maxime nobis eveniet ab necessitatibus, praesentium iure perspiciatis nisi amet. Officiis architecto deleniti neque dignissimos qui minus tenetur placeat! Saepe ipsum dicta earum distinctio eaque quibusdam neque nesciunt sit voluptatibus nam.</p>
			</div>
			<div class="page p3">
				<h1>Headline for a book</h1>
				<p>Ex excepturi consequatur eius laborum blanditiis non architecto in ut dicta praesentium at labore quae natus velit sint, fugit voluptas ullam, dolore, consectetur, vitae debitis sit? Doloribus, perspiciatis, corporis. Sint perferendis natus, non distinctio. Similique, recusandae, consectetur. Sint, ipsum dolorem quibusdam consequatur adipisci fugit necessitatibus nostrum cupiditate modi, in, debitis!</p>
			</div>
			<div class="page p4">
				<h1>Headline for a book</h1>
				<p>Corrupti maiores aperiam velit earum ut voluptatem, necessitatibus ratione quo voluptates dicta cupiditate dolore ea sapiente sed. Suscipit rem porro in necessitatibus quo quos id adipisci eum iure alias sint sed, beatae delectus sapiente sit natus illum nulla nisi ea, quidem labore voluptas, fugit laboriosam. Incidunt corporis ratione dolores earum!</p>
			</div>
			<div class="page p5">
				<h1>Headline for a book</h1>
				<p>Laudantium facilis molestias labore, nemo, magni tenetur laborum praesentium aspernatur magnam veniam totam eius molestiae sunt fuga debitis asperiores autem at voluptatum nesciunt accusamus officiis. Aspernatur voluptatem esse omnis veritatis, qui atque cumque modi expedita. Similique magnam magni totam ducimus ipsam eveniet, aspernatur fuga? Commodi nobis facere cupiditate aperiam amet?</p>
			</div>
			<div class="page p6">
				<h1>Headline for a book</h1>
				<p>Maiores in, porro illo expedita vitae sed ea quo iure, doloribus nemo ullam dolore ut excepturi laudantium eveniet. Libero aspernatur nemo error soluta tempora officia ad aperiam inventore, veritatis, aliquam quaerat excepturi esse id ipsa. Minus, nisi, error! Veniam velit officiis facere iusto illo quia earum quisquam recusandae quas expedita.</p>
			</div>
			<div class="page p7">
				<h1>Headline for a book</h1>
				<p>Atque recusandae ea tenetur. Magnam saepe a reiciendis sunt dolorem quam quae tempore incidunt vero iure temporibus quibusdam aut cupiditate, excepturi rerum officia maiores ab! Quasi, ratione excepturi laudantium nulla. Dolorum quia aperiam exercitationem repellat rerum quam optio, beatae eveniet. Tempora, quo ab illum pariatur totam ad quidem animi dolorum.</p>
			</div>
			<div class="page p8">
				<h1>Headline for a book</h1>
				<p>Magnam, similique! Cumque, non maiores quidem amet odio delectus dignissimos officia, voluptatum sunt nulla expedita placeat excepturi? Minima dignissimos quidem corrupti aspernatur perferendis explicabo, ipsa saepe! Obcaecati dolore quis, illo, provident veritatis tempora, veniam omnis dolorum sit, quibusdam assumenda animi esse excepturi neque cumque sapiente rerum. Maiores fugiat nisi, officiis?</p>
			</div>
			<div class="page p9">
				<h1>CSS3 3D transitions</h1>
				<p>To me, this is the most <b>fun</b>part of css coding. Now you can animate litte nice 3D like transitions that I ever wanted to do since my first Commodore 64. Just with a few lines of code et voilà, here's your 3D book. You just need:
					<code>transform-style: preserve-3d;
</code> or
					<code>perspective: 800px;</code>They're the basics of a 3D effect. Wanna know more about it? Here you find a easy introduction at<br><a href="https://css-tricks.com/" target="_blank">CSS-Tricks.com◥</a></p>
			</div>
			<div class="page p10">
				<h1>Headline for a book</h1>
				<p>At placeat quam vel reiciendis eaque maxime sit repellendus optio unde quo quibusdam eum similique aliquid, tempore esse consequatur rerum aut voluptate debitis tenetur dolore id quis, commodi? Eos laborum perferendis nam. Porro recusandae asperiores sunt impedit, amet dolore cum aliquid, dolorem quisquam, nihil nisi. Quibusdam labore eligendi, consectetur id.</p>
			</div>
			<div class="page p11">
				<h1>Headline for a book</h1>
				<p>Ut, ratione, omnis! Iste amet id animi odit optio impedit tempora rerum hic sapiente, libero quod eos ipsam recusandae ratione voluptate consequuntur, officiis facilis, pariatur similique quam excepturi inventore ipsa nihil, sed iusto? Aperiam dolorem fugit numquam, expedita perferendis, beatae sapiente ducimus ipsa est consectetur quae, at eaque vero porro!</p>
			</div>
			<div class="page p12">
				<h1>Headline for a book</h1>
				<p>Aliquam et minima harum qui, assumenda sequi modi amet eum quas soluta veritatis autem consequatur eius natus voluptas necessitatibus laudantium molestias quaerat, commodi molestiae voluptatum laboriosam aperiam! Quia praesentium dolore omnis culpa laborum incidunt repudiandae maiores ea officiis quas voluptates cumque, reprehenderit temporibus, eligendi sequi. Quam vitae nostrum perferendis autem!</p>
			</div>
			<div class="page p13">
				<h1>Headline for a book</h1>
				<p>Itaque a cum recusandae repellat accusantium debitis ipsa quae autem, eius, dolor corporis enim. Nobis inventore, blanditiis laborum in eum ea at provident iure repudiandae, vero sit suscipit sapiente accusantium quo sint voluptatem excepturi eligendi saepe alias vel eos fugit ipsam. Accusamus, blanditiis, alias. Quos nesciunt quidem dolore reprehenderit nisi.</p>
			</div>
			<div class="page p14">
				<h1>Headline for a book</h1>
				<p>Nulla, sapiente. Ipsam laboriosam culpa autem vitae iste, quasi voluptas sint. Molestias necessitatibus magnam quas minus velit quidem animi sit, placeat doloribus provident assumenda architecto totam, hic, voluptas quisquam odio quae laborum cumque praesentium dolorum mollitia eum omnis. Quibusdam omnis aperiam repellat unde iste eveniet quo, quae reiciendis eligendi odit.</p>
			</div>
			<div class="page p15">
				<h1>Headline for a book</h1>
				<p>Porro fugiat dignissimos magnam rem soluta illo quisquam corrupti dolores quos rerum reprehenderit vitae ducimus provident quod ea est libero iusto labore corporis, atque. Dolore optio at, voluptas, aspernatur nihil quia non, velit ex exercitationem tempore cum, nulla minima esse autem. Temporibus aspernatur id officiis amet nesciunt officia molestias aliquam.</p>
			</div>
			<div class="page p16">
				<h1>Headline for a book</h1>
				<p>Nihil dignissimos cumque magni accusantium omnis aperiam autem, porro dolor veritatis ab alias beatae pariatur, vel earum esse eligendi nisi? Culpa repellendus aliquam dignissimos dolor asperiores deserunt nam est consequatur molestias distinctio, ipsum et, totam laborum id nemo. Omnis incidunt est, ex porro nihil accusantium, voluptatibus recusandae. Laudantium, dignissimos, repudiandae?</p>
			</div>
		</div>
	</article>
</section>
            
          
!
            
              // vars
$settings: (
	vpc: 0deg, // viewport closed
	vpo: 45deg, // viewport opened
	deg: -5, // angle pages left
	toDeg: -1, // angle pages right
	off: 0,
	toOff: 160, // angle for open
);

$random_color: rgba(random(255),random(255),random(255),.5);

$c: ( // colors
	s: #000,
	w: #fff,
	gr: #F0F0EF,
	y: #EDD690,
	g: #B1BD5D,
	b: #955A47,
	bl: #2772DB,
	bg: $random_color,
);

// set in settings
$f: unquote("'Podkova', serif"); 
$fz: 16px;

@function clr($col) { // usage: clr(s) from $c
	@return get($c, $col);
};
@function pref($setting) { // usage: clr(s) from $c
	@return get($settings, $setting);
};


// --------- defaults ---------
* {
	&:focus {
		outline: 0;
	}
	
	&, &:before, &:after {
		box-sizing: border-box;
	}
}
@include placeholder(){
		font-family: $f;
}
// --------------------

html {
	background-color: clr(s);
	
	body {
		font-family: $f;
		font-size: $fz;
		color: clr(w);
		background-color: clr(bg);
	}
	
	&, body {
		position: absolute;
		left: 0;
		right: 0;
		top: 0;
		bottom: 0;
		width: 100vw;
		height: 100vh;
		overflow: hidden;
	}
}

#sect	{
	width: 100vw;
	margin: 5% auto;
	padding: 1em;
	border-radius: .5em;
	font-size: 3em;
	//background-color: #444;
}

$vp-open: pref(vpo);
$vp-clsd: pref(vpc);

code {
	font-family: Courier, serif;
	display: block;
	background-color: rgba(clr(s), .2);
	padding: .25em .5em;
	font-size: .76em;
}

#book { // main container
	transform-style: preserve-3d;
	transform-origin: left center;
	left: 28vw;
	
	@media screen and (min-width: 50em) {
			left: 33vw;
	}
	width: 7em;
	height: 8em;
	perspective: 800px;
	position: relative;
	cursor: url(http://icons.iconarchive.com/icons/glyphish/glyphish/32/12-eye-icon.png), zoom-in; 
	//background-color: clr(b);

	.viewport { // viewport
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		font-size: .7em;
		transform-style: preserve-3d;
		transform-origin: center center;
		transition: all 1s ease-in;
		transform: scale(.4) rotateX($vp-clsd);
		
		.page { // a single page
			position: absolute;
			width: 7em;
			height: 10em;
			left: 45%;
			padding: .5em;
			overflow: hidden;
			background: #fff;
			color: #000;
			border-left: 2px solid clr(b);
			box-shadow: inset 1em 0 2em rgba(black, .1), inset 0 -2em 3em rgba(black, .3), .5em .5em 1em rgba(black, .05);
			//backface-visibility: hidden;
			transform-origin: left top;
			transition: all 1s ease-in;
			counter-increment: page;
			padding-top: 1.5em;
			
			h1 {
				font-weight: 700;
				font-size: .6em;
			}
			
			a {
				color: #004;
				font-weight: bold;
				text-decoration: none;
				
				&:hover {
					text-decoration: underline;
				}
			}
		
			&:not(:first-child):before { // # in title
				content: counter(page);
				width: 100%;
				display: block;
				font-size: .5em;
				border-bottom: 1px solid rgba(black, .4);
				position: absolute;
				text-align: right;
				padding: .3em .5em 0 0;
				color: #888;
				left: 0;
				right: 0;
				top: 0;
			}

			&:first-child { // front cover
				background-color: clr(y);
				padding-top: .5em;
				
				&:after {
					content: "©";
					position: absolute;
					bottom: -.25em;
					right: -1em;
					width: 3em;
					text-align: center;
					color: #fff;
					font-size: .8em;
					padding: .25em;
					transform: rotate(-45deg);
					background-color: clr(bl);
				}
				
				h1 {
					position: absolute;
					left: 0;
					right: 0;
					top: 0;
					padding: .25em;
					font-size: 1.5em;
					font-weight: 700;
					background-color: rgba(clr(g), .7);
					@include mix(2);
				}
				
				p {
					font-size: 1.1em;
					margin-top: 4em;
					text-align: right;
					word-break: normal;
					-webkit-font-smoothing: antialiased;
				}
			}
			&:nth-child(8) { // left page when open
				&:before {
					z-index: -2;
				}
				
				&:after { 
					content: '__________________________						Die Religiosität führt sich biologisch auf die langanhaltende Hilflosigkeit und Hilfsbedürftigkeit des kleinen Menschenkindes zurück, welches, wenn es später seine wirkliche Verlassenheit und Schwäche gegen die großen Mächte des Lebens erkannt hat, seine Lage ähnlich wie in der Kindheit empfindet und deren Trostlosigkeit durch die regressive Erneuerung der infantilen Schutzmächte zu verleugnen versucht.                                                                           ... Sigmund Freud, 1923';
					position: absolute;
					font-size: .42em;
					padding: 1em 1em .5em;
					top: 0;
					left: 0;
					right: 0;
					bottom: 0;
					background-color: #fff;
					transform: rotateY(180deg);
					box-shadow: inset 2em 0 2em rgba(black, 0), inset -4em 0 3em rgba(black, .3), 0 -2em 1em rgba(black, .05);
				}
			}
			&:nth-child(9) { //right page when open
				overflow: visible;
				
				p {
					max-height: 90%;
					height: 100%;
				}
				
				&:after { // bookmark
					content: '';
					position: fixed;
					top: -.5em;
					left: .3em;
					width: 1.5em;
					height: 7em;
					background-color: #800;
					display: block;
					box-shadow: .2em .2em .2em rgba(black, .4);
					transform: translateZ(-3px) rotate(3deg);
				}
			}
		}	
		
		p {
			font-size: .42em;
			text-align: justify;
			hyphens: all;
			// word-break: break-word;
			// word-break: break-all;
			max-height: 80%;
			overflow: hidden;
			-webkit-font-smoothing: antialiased;
		}
	}
	
			$deg: pref(deg); // angle between  pages
			$toDeg: pref(toDeg);
			$offset: pref(off); // will be angle for open
			$toOffset: pref(toOff);

			// the arrangement of the pages
			@for $p from 1 through 16 { 
				// toggle open fold
				@if ($p > 8) {$offset: $toOffset; $deg: $toDeg;}
				
					.viewport .page:nth-child( #{$p} ) {
						transform: translateZ((2px - $p));
						z-index: -$p;
				}
					&:hover .viewport { // reveal book laying
						transform: rotateX($vp-open) scale(1);

						// open book
						.page:nth-child( #{$p} ) {
							box-shadow: inset 1em 0 1em rgba(black, 0), inset 3em 0 3em rgba(black, .3), 0 2em 1em rgba(black, .05);
							transform: translateZ((2px - $p)) rotateY(180deg - ($deg * ($p - 1)) + $offset);
							//backface-visibility: visible;
							//direction: rtl;
						}
					}
				}
	
			.viewport .page:first-child {
				transform: translateZ(8px);
			}
			// offset for cover
			&:hover .viewport .page:first-child {
				transform: translateZ(10px) rotateY(180deg) translateZ(15px);
			}


}

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console