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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

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

              
                <div class ="book-container">
  <div class = "book">
    
    <div class = "page-container page-A">
      <div class = "page front page-A-front">
        <h1>Mrs. Dalloway</h1>
        <h3>An Excerpt from Chapter One</h3>
        
        <h2>by Virginia Woolf</h2>
      </div>
      <div class = "page back page-A-back">
        <p>Mrs. Dalloway said she would buy the flowers herself.</p>
        <p>For Lucy had her work cut out for her. The doors would be taken off their hinges; Rumpelmayer's men were coming. And then, thought Clarissa Dalloway, what a morning--fresh as if issued to children on a beach.</p>
        <p>What a lark! What a plunge! For so it had always seemed to her, when, with a little squeak of the hinges, which she could hear now, she had burst open the French windows and plunged at Bourton into the open air. How fresh, how calm, stiller than this of course, the air was in the early morning; like the flap of a wave; the kiss of a wave; chill and sharp and yet (for a girl of eighteen as she then was) solemn, feeling as she did, standing there at the open window, that something awful was about to happen; looking at the flowers, at the trees with the smoke winding off them and the rooks rising, falling; standing and looking until Peter Walsh said, "Musing among the vegetables?"--was that it?--"I prefer men to cauliflowers"--was that it? He must have said it at breakfast one morning when she had gone out on to the terrace--Peter Walsh. He would be back from India one of these days, June or July, she forgot which, for his letters were awfully dull; it was his sayings one remembered; his eyes, his pocket-knife, his smile, his grumpiness and, when millions of things had utterly vanished--how strange it was!--a few sayings like this about cabbages.</p>
      </div>
    </div>
    
    <div class = "page-container page-B">
      <div class = "page front page-B-front">
      <p>She stiffened a little on the kerb, waiting for Durtnall's van to pass. A charming woman, Scrope Purvis thought her (knowing her as one does know people who live next door to one in Westminster); a touch of the bird about her, of the jay, blue-green, light, vivacious, though she was over fifty, and grown very white since her illness. There she perched, never seeing him, waiting to cross, very upright.</p>

<p>For having lived in Westminster--how many years now? over twenty,--one feels even in the midst of the traffic, or waking at night, Clarissa was positive, a particular hush, or solemnity; an indescribable pause; a suspense (but that might be her heart, affected, they said, by influenza) before Big Ben strikes. There! Out it boomed. First a warning, musical; then the hour, irrevocable. The leaden circles dissolved in the air. Such fools we are, she thought, crossing Victoria Street. For Heaven only knows why one loves it so, how one sees it so, making it up, building it round one, tumbling it, creating it every moment afresh; but the veriest frumps, the most dejected of miseries sitting on doorsteps (drink their downfall) do the same; can't be dealt with, she felt positive, by Acts of Parliament for that very reason: they love life. In people's eyes, in the swing, tramp, and trudge; in the bellow and the uproar; the carriages, motor cars, omnibuses, vans, sandwich men shuffling and swinging; brass bands; barrel organs; in the triumph and the jingle and the strange high singing of some aeroplane overhead was what she loved; life; London; this moment of June.</p>
      </div>
      <div class = "page back page-B-back">
      <p>For it was the middle of June. The War was over, except for some one like Mrs. Foxcroft at the Embassy last night eating her heart out because that nice boy was killed and now the old Manor House must go to a cousin; or Lady Bexborough who opened a bazaar, they said, with the telegram in her hand, John, her favourite, killed; but it was over; thank Heaven--over. It was June. The King and Queen were at the Palace. And everywhere, though it was still so early, there was a beating, a stirring of galloping ponies, tapping of cricket bats; Lords, Ascot, Ranelagh and all the rest of it; wrapped in the soft mesh of the grey-blue morning air, which, as the day wore on, would unwind them, and set down on their lawns and pitches the bouncing ponies, whose forefeet just struck the ground and up they sprung, the whirling young men, and laughing girls in their transparent muslins who, even now, after dancing all night, were taking their absurd woolly dogs for a run; and even now, at this hour, discreet old dowagers were shooting out in their motor cars on errands of mystery; and the shopkeepers were fidgeting in their windows with their paste and diamonds, their lovely old sea-green brooches in eighteenth-century settings to tempt Americans (but one must economise, not buy things rashly for Elizabeth), and she, too, loving it as she did with an absurd and faithful passion, being part of it, since her people were courtiers once in the time of the Georges, she, too, was going that very night to kindle and illuminate; to give her party.
      </div>
    </div>
    
        <div class = "page-container page-C">
      <div class = "page front page-C-front">
      <p> But how strange, on entering the Park, the silence; the mist; the hum; the slow-swimming happy ducks; the pouched birds waddling; and who should be coming along with his back against the Government buildings, most appropriately, carrying a despatch box stamped with the Royal Arms, who but Hugh Whitbread; her old friend Hugh--the admirable Hugh!</p>

<p>"Good-morning to you, Clarissa!" said Hugh, rather extravagantly, for they had known each other as children. "Where are you off to?"</p>

<p>"I love walking in London," said Mrs. Dalloway. "Really it's better than walking in the country."</p></p>
      </div>
      <div class = "page back page-C-back">
      </div>
    </div>
  </div>
</div>

<!-- signature -->

	<a href="https://codepen.io/maxew33" class="signature" target="_blank">
		<div class="link">
			<span class="brace">
				{
			</span>
			<span class="before">
				<span class="before-text">
					&nbsp;by
				</span>
			</span>
			<span class="my-name">
				m
			</span>
			<span class="after">
				<span class="after-text">
					<span class="spin">axe</span>
					<span>w</span>
				</span>
			</span>
			<span class="brace">
				}
			</span>
		</div>
	</a>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css2?family=Alice&display=swap');

:root{
  --rotate-A: 0deg;
  --rotate-B: 0deg;  
  --rotate-C: 0deg;
  --translate: 50%;
  --z-index-A: 10;
  --z-index-B: 5;  
  --z-index-C: 1;
  --cover-color: hsl(150deg, 100%, 15%);
  --page-first-color: hsl(36, 48%, 80%);
  --page-second-color: hsl(36, 48%, 70%);
  --page-last-color: hsl(36, 48%, 25%);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.book-container {
  min-height: 100vh;
  width: 100vw;
  background: radial-gradient(circle at center, hsl(0deg, 0%, 0%), hsl(0deg, 0%, 10%));
  display: grid;
  place-content: center;
  overflow: hidden;
}

.book {
  position: relative;
  width: min(100vw, 1000px);
  height: min(60vw, 600px);
  perspective: min(300vw, 3000px);
}

.page-container{
  position: absolute;
  height: inherit;
  width: min(50vw, 500px);
  cursor: pointer;
  transition: .5s transform ease-in-out;
  transform-style: preserve-3d;
  transform-origin: left;  
}

.page-A{
  transform: translate(var(--translate)) rotateY(var(--rotate-A));
  z-index: var(--z-index-A);
}

.page-B{  
  transform: translate(var(--translate)) rotateY(var(--rotate-B));
  z-index: var(--z-index-B);
}

.page-C{  
  transform: translate(var(--translate)) rotateY(var(--rotate-C));
  z-index: var(--z-index-C);
}

.page{
  position: absolute;
  backface-visibility: hidden;
  height: inherit;
  width: inherit;
  padding: min(10px, 1vw) min(15px, 1.5vw);
}

.front{  
  border-radius: 5px 15px 15px 5px;
}

.back{
  border-radius: 15px 5px 5px 15px;
  transform: rotateY(180deg);
}

.page-A-front,
.page-C-back{
  background: var(--cover-color);
  background-image: url('https://zupimages.net/up/21/47/zxra.png');
  background-size: contain;
  background-repeat: no-repeat;
}

.page-A-front{
  font-family: 'Alice', serif;
  color: #ffcc00;
  
  *{
    display: inline-block;
    position: absolute;
    text-align: center;
  }
  
  h1{
    font-size: min(56px, 5.6vw);
    display: inline-block;
    position: absolute;
    text-align: center;
    top: 35%;
    left: 50%;
    text-shadow: 5px 2.5px 0 hsl(0deg, 0%, 0%, .25);
    transform: translate(-50%, -50%);
  }
  
  h2{
    font-size: min(24px, 2.4vw);
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
  }
  
  h3{
    font-size: min(16px, 1.6vw);
    font-style: italic;
    top: 60%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
}

.page-A-back,
.page-B-back{
  background: linear-gradient(90deg, var(--page-first-color) 30%, var(--page-second-color), var(--page-last-color));
}

.page-B-front,
.page-C-front{
  background: linear-gradient(90deg, var(--page-last-color), var(--page-second-color), var(--page-first-color) 60%) ;
}

.page-A-back,
.page-B,
.page-C-front{  
  line-height: min(24px, 2.4vw);
  font-size: min(16px, 1.6vw);
  p{
    margin-bottom: min(5px, 0.5vw);
  }
  p::first-letter {
    font-size: min(24px, 2.4vw);
  }
}

/* signature */

.signature {
	position: absolute;
	left: 0;
	bottom: 0;
}

.link {
	position: absolute;
	z-index: 10;
	left: calc(5vmin - 1rem);
	bottom: calc(5vmin - 1rem);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;

	span {
		font-size: 2rem;
		font-family: arial, sans-serif;
    color: #ffcc00;
	}

	.my-name {
		position: relative;
	}

	.before,
	.after {
		overflow: hidden;
		width: 0px;
		transition: width 0.5s;
		transform-origin: right;
	}

	.before-text {
		display: inline-block;
		width: auto;
		text-align: right;
	}

	.after-text {
		display: flex;
		align-items: center;
		width: auto;
		height: 3rem;
		transform-origin: top center;
	}

	&:hover .before {
		width: 3.5rem;
	}

	&:hover .after {
		width: 5rem;
	}

	&:hover .spin {
		display: inline-block;
		transition: 0.5s transform 0.5s ease-in-out;
		transform: rotate(360deg);
	}
}

@media only screen and (max-width: 767px) and (orientation: portrait) {
  .book {
    width: 100vw;
    height: 50vh;
  }
  
  .page-container{
    position: absolute;
    height: inherit;
    width: 100vw;
    transform-origin: top;  
  }

  .page-A{
    transform: translateY(calc(-50% + var(--translate))) rotateX(var(--rotate-A));
  }

  .page-B{  
    transform: translateY(calc(-50% + var(--translate))) rotateX(var(--rotate-B));
  }

  .page-C{  
    transform: translateY(calc(-50% + var(--translate))) rotateX(var(--rotate-C));
  }
  
  .front{  
    border-radius: 5px 5px 15px 15px;
  }

  .back{
    border-radius: 15px 15px 5px 5px;
    transform: rotateX(180deg);
  }

  .page-A-front,
  .page-C-back{
    background-image: none;
  }
  
  
  .page-A-back,
  .page-B-back{
    background: linear-gradient(180deg, var(--page-first-color) 50%, var(--page-second-color) , var(--page-last-color));
  }

  .page-B-front,
  .page-C-front{
    background: linear-gradient(180deg, var(--page-last-color), var(--page-second-color), var(--page-first-color) 50%) ;
  }
  
  
  .page-A-front{
    h1{
      font-size: 7.5vh;
    }

    h2{
      font-size: 3vh;
    }

    h3{
      font-size: 2vh;
    }
  }


  .page-A-back,
  .page-B,
  .page-C-front{  
    line-height: 2vh;
    font-size: 1.6vh;
    p{
      margin-bottom: 0.5vh;
    }
    p::first-letter {
      font-size: 2.4vh;
    }
  }
}
              
            
!

JS

              
                //forked by https://codepen.io/maxew33/pen/LYjKNVx
const pageAFront = document.querySelector('.page-A-front'),
      pageBFront = document.querySelector('.page-B-front'),
      pageABack = document.querySelector('.page-A-back'),
      pageBBack = document.querySelector('.page-B-back'),
      pageCFront = document.querySelector('.page-C-front'),
      pageCBack = document.querySelector('.page-C-back'),
      bookContainer = document.querySelector('.book-container')

let angle = '-180deg'

const pageOrientation = () =>{
   bookContainer.getBoundingClientRect().width > bookContainer.getBoundingClientRect().height ? angle = '-180deg' : angle = '180deg'
  console.log(angle)
}

pageOrientation()

pageAFront.addEventListener('click', () => {
  document.documentElement.style.setProperty('--rotate-A', angle)
  document.documentElement.style.setProperty('--translate', '100%')
})

pageBFront.addEventListener('click', () => {
  document.documentElement.style.setProperty('--rotate-B', angle)
  document.documentElement.style.setProperty('--z-index-A', '1')
})

pageCFront.addEventListener('click', () => {
  document.documentElement.style.setProperty('--rotate-C', angle)
  document.documentElement.style.setProperty('--translate', '150%')
  document.documentElement.style.setProperty('--z-index-C', '10')
})

pageABack.addEventListener('click', () => {
  document.documentElement.style.setProperty('--rotate-A', '0deg')
  document.documentElement.style.setProperty('--translate', '50%')
  document.documentElement.style.setProperty('--z-index-A', '10')
})

pageBBack.addEventListener('click', () => {
  document.documentElement.style.setProperty('--rotate-B', '0deg')
  document.documentElement.style.setProperty('--z-index-C', '1')
})


pageCBack.addEventListener('click', () => {
  document.documentElement.style.setProperty('--rotate-C', '0deg')
  document.documentElement.style.setProperty('--translate', '100%')
})

// Listen for resize changes
window.addEventListener("resize", function() {
  pageOrientation()
}, false);
              
            
!
999px

Console