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 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="container">
	<div class="row">
		<div class="section">
			<div class="paper ruled"></div>
			<p class="caption">Yellow Ruled</p>
		</div>
		<div class="section">
			<div class="paper fold-corner"></div>
			<p class="caption">Fold Corner (hover)</p>
		</div>
		<div class="section">
			<div class="paper lift"></div>
			<p class="caption">Lift (hover)</p>
		</div>
	</div>
	<div class="row">
		<div class="section">
			<div class="paper stacked"></div>
			<p class="caption">Stacked</p>
		</div>
		<div class="section">
			<div class="paper fold-middle">
				<div class="slice one">
					<div class="slice two overlay">
						<div class="slice three">
							<div class="slice four overlay"></div>
						</div>
					</div>
				</div>
			</div>
			<p class="caption">Fold Middle (hover)</p>
		</div>
		<div class="section">
			<div class="paper rounded"></div>
			<p class="caption">Rounded Corners</p>
		</div>
	</div>
</div>
              
            
!

CSS

              
                // Variables
$yellow-paper: rgb(248, 234, 105);
$white-paper: #f1f1f1;
$paper-width: 15rem;
$paper-height: 19rem;
$transition-time: 0.4s;
$number-of-middle-folded-parts: 4;
$fold-part-height: $paper-height / 4;

// Mixins
@mixin stacked-shadow($through, $even-color, $odd-color) {
    $shadow : "";
    @for $i from 1 through $through {
        @if ($i % 2 == 0) {
            $shadow : $shadow + "#{$i}px #{$i}px 0 0 #{$even-color}";
        }
        @else {
            $shadow : $shadow + "#{$i}px #{$i}px 0 0 #{$odd-color}";            
        }
        $shadow : $shadow + if($i != $through, ", ", "");
    }
    box-shadow: unquote($shadow);
}

// Styles
html {
    font-size: 62.5%;
    box-sizing: border-box;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: inherit;
}
body {
    background: teal;
}
.container {
    width: 100%;
    min-height: 60rem;
    padding: 6rem;
}
.row {
    display: flex;
    flex-flow: row wrap;
    justify-content: space-around;
}
.section {
    margin: 0 2rem 4rem;
    flex: 1;
    flex-basis: 0;
}
.paper {
    width: $paper-width;
    margin: 0 auto;
    height: $paper-height;
    position: relative;
}
.ruled {
    background-color: $yellow-paper;
    background-image: repeating-linear-gradient(transparent 0, transparent 1em, skyblue 0, skyblue 1.1em);
    &::after {
        content: "";
        position: absolute;
        left: 1.5rem;
        top: 0;
        height: 100%;
        width: .1rem;
        border-color: rgba(220, 0, 0, 0.5);
        border-style: solid;
        border-width: 0 .1rem 0 .1rem;
    }
}
.fold-corner {
    background: indigo;
    &::after {
        content: "";
        position: absolute;
        right: 0;
        top: 0;
        border-style: solid;
        border-width: .5rem;
        border-color: teal teal silver silver;
        transition: all $transition-time;
    }
    &:hover::after {
        border-width: 3rem;
    }
}

%lift-corner {
    content: "";
    position: absolute;
    z-index: -1;
    width: 45%;
    height: .2rem;
    bottom: 3px;
    box-shadow: 0 .45rem 4px 0 black;
    transition: all $transition-time;
}
.lift {
    background: rgb(54, 209, 209);
    &::after{
        @extend %lift-corner;
        right: 3px;
        transform: rotate(5deg);
    }
    &::before {
        @extend %lift-corner;
        left: 3px;
        transform: rotate(-5deg);
    }
    &:hover::after, &:hover::before {
        bottom: 7px;
    }
}

.stacked {
    background: $white-paper;
    @include stacked-shadow($through: 6, $even-color: silver, $odd-color: rgb(60, 60, 60));
}

.fold-middle {
    perspective: 700px;
    .slice {
        width: 100%;
        height: $fold-part-height;
        position: relative;
        transform-style: preserve-3d;
        background: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/175711/chicken.jpg");
        transition: all $transition-time;
    }
    &:hover .one {
        transform: rotateX(-45deg);
    }
    &:hover .two, &:hover .four {
        transform: translateY($fold-part-height) rotateX(90deg);
    }
    &:hover .three {
        transform: translateY($fold-part-height) rotateX(-90deg);
    }
    &:hover .overlay::after {
        opacity: 1;
    }
}
.slice.one {
    transform-origin: bottom;
}

$slices: two, three, four;
$i: 1;
@each $slice in $slices {
    .slice.#{$slice} {
        background-position-x: 0;
        background-position-y: -($fold-part-height * $i);
        transform: translateY($fold-part-height);
        transform-origin: top;
    }
    $i : $i + 1;
}

.overlay::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(50, 50, 50, 0.4);
    opacity: 0;
    transition: all $transition-time;
}
.rounded {
    background: $yellow-paper;
    border-top-left-radius: 250px 15px;
    border-bottom-left-radius: 20px 115px;
    border-bottom-right-radius: 105px 15px;
}

p {
    font-size: 1.6em;
    font-family: cursive;
    color: white;
    text-align: center;
    margin-top: .65em;
}
::selection {
    background: indigo;
    color: indianred;
}
              
            
!

JS

              
                // no javascirpt
              
            
!
999px

Console