Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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 id="handmaid" class="book">
  <div class="gloss"></div>
  <img class="cover" src="https://raw.githubusercontent.com/robole/artifice/main/shiny-book-reveal/img/cover.png">
  <div class="description">
    <h1>The Handmaid's Tale</h1>
    <hr>
    <p>In the Republic of Gilead, formerly the United States, far-right Schlafly/Falwell-type ideals
      have been carried to extremes in the monotheocratic government. The resulting society is a
      feminist's nightmare: women are strictly controlled, unable to have jobs or money and assigned
      to various classes: the chaste, childless Wives; the housekeeping Marthas; and the reproductive
      Handmaids, who turn their offspring over to the "morally fit" Wives. The tale is told by Offred
      (read: "of Fred"), a Handmaid who recalls the past and tells how the chilling society came to be.</p>
    <blockquote>“A novel that brilliantly illuminates some of the darker interconnections between politics and
      sex...just as the world of Orwell’s 1984 gripped our imaginations, so will the world of Atwood’s handmaid!”
      <br><i>Washington Post Book World</i></blockquote>
  </div>
</div>
<h1>The Handmaid's Tale</h1>
<div class="rating">
  <span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span>
</div>
              
            
!

CSS

              
                /*Hover to reveal a description of the book */

/* Source code:
https://github.com/robole/artifice
*/

@import url('https://fonts.googleapis.com/css2?family=Pontano+Sans&family=Stint+Ultra+Expanded&display=swap');

:root{
  --perspective: 1000px;
  --link-color:#010790;
}

* {
	box-sizing: border-box;
}

body{
  font-family: 'Pontano Sans', sans-serif;
  font-size: calc(0.65em + .05vw);
}

a{
  color:var(--link-color);
  font-weight:bold;
}

h1{
  font-family: 'Stint Ultra Expanded', cursive;
  font-size: 1.5em;
  text-align: center;
}

.book {
  display: block;
  position: relative;
  width: 320px;
	height:453px;
  margin:0 auto;
	margin-top: 5rem;
}

.gloss{
  position: absolute;
  top:0;
	z-index:200;
  overflow: hidden;
  width:20%;
  height:100%;
  opacity:0.5;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.2), rgba(255,255,255,0));
  transition:all .5s;
  transform: translateX(-50%) rotateY(0deg);
  transform-origin: left center;
}

.cover {
	position: absolute;
  width:100%;
	z-index:100;
  transition:transform .5s;
  transform: translateX(0);
  transform-origin: left center;
  backface-visibility: hidden;
}

.description{
  position: absolute;
  left:0;
  top:0;
  width:inherit;
  height:inherit;
	border: solid 1px grey;
	background:white;
	transition: all 1s;
	padding: 10% 10%;
  padding-top:5%;
  z-index:1;
}

.description h1{
  font-family: 'Pontano Sans', sans-serif;
	font-size: calc(0.75em + .1vw);
  text-align: center;
  line-height: 1.25em;
}

.book:hover{
		cursor: pointer;
}

.book:hover .cover {
    transform: perspective(var(--perspective)) rotateY(-80deg);
}

.book:hover .gloss {
    transform: perspective(var(--perspective)) rotateY(-80deg) translateX(100%) scaleX(5);
}

.book:hover .description {
    transform: translateX(20%);
}

.rating {
  unicode-bidi: bidi-override;
  direction: rtl;
  text-align: center;
  height:2em;
  margin:0 auto;
  color:grey;
}

.rating > span {
  display: inline-block;
  position: relative;
  font-size: 1.75em;
  margin-right:.2em;
}

.rating > span ~ span:before {
   content: "\2605";
   position: absolute;
   color:#8d2a06;
}

              
            
!

JS

              
                
              
            
!
999px

Console