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

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

              
                <body>
	<input type="checkbox" class="check slide" id="checked-slide">
	<input type="checkbox" class="check fade" id="checked-fade">
	<input type="checkbox" class="check push" id="checked-push">
	<input type="checkbox" class="check pull" id="checked-pull">
	<label class="switch slide" for="checked-slide"></label>
	<label class="switch fade" for="checked-fade"></label>
	<label class="switch push" for="checked-push"></label>
	<label class="switch pull" for="checked-pull"></label>
	<div class="gatefold">
		<header class="header">
			<h1>CSSで画像を真っ二つに切り開く</h1>
		</header>
		<main class="contents">
			<section class="contents__inner">
				<h2>HTML</h2>
				<pre><code>
&lt;input type="checkbox" class="check slide" id="checked-slide"&gt;
&lt;input type="checkbox" class="check fade" id="checked-fade"&gt;
&lt;input type="checkbox" class="check push" id="checked-push"&gt;
&lt;input type="checkbox" class="check pull" id="checked-pull"&gt;
&lt;label class="switch slide" for="checked-slide">&lt;/label&gt;
&lt;label class="switch fade" for="checked-fade"&gt;&lt;/label&gt;
&lt;label class="switch push" for="checked-push"&gt;&lt;/label&gt;
&lt;label class="switch pull" for="checked-pull"&gt;&lt;/label&gt;
&lt;div class="gatefold"&gt;
	&lt;header class="header"&gt;
		&lt;h1&gt;ヘッダー&lt;/h1&gt;
	&lt;/header&gt;
	&lt;main class="contents"&gt;
		&lt;section class="contents__inner"&gt;
			&lt;h2&gt;HTML&lt;/h2&gt;
			&lt;p&gt;ここにコンテンツ&lt;/p&gt;
		&lt;/section&gt;
	&lt;/main&gt;
	&lt;footer class="footer"&gt;
		&lt;p>フッター&lt;/p&gt;
	&lt;/footer&gt;
&lt;/div&gt;
				</code></pre>
			</section>
			<section class="contents__inner">
				<h2>CSS</h2>
				<pre><code>
/* --------------------------------------------------- gatefold */
.gatefold {
	width: 100%;
	height: 100%;
}

.gatefold::after {
	content: '';
	position: fixed;
	top: 0;
	right: 0;
	width: 100%;
	height: 100vh;
	background: url(../images/gatefold.jpg) top center no-repeat;
	background-size: cover;
	-webkit-transition: all 1s;
	transition: all 1s;
	clip: rect(0px 100vw 100vh 50vw);
	z-index: 1;
}

.gatefold::before {
	content: '';
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100vh;
	background: url(../images/gatefold.jpg) top center no-repeat;
	background-size: cover;
	-webkit-transition: all 1s;
	transition: all 1s;
	clip: rect(0px 50vw 100vh 0px);
	z-index: 1;
}

/* --------------------------------------------------- contents */
.header,
.contents,
.footer {
	max-width: 1000px;
	margin: 0 auto;
	padding: 80px 0;
	text-align: center;
}

.contents {
	padding: 0;
}

.contents__inner {
	box-sizing: border-box;
	max-width: 680px;
	height: 100%;
	margin: 40px auto 0;
	padding: 20px;
	text-align: left;
	background: #eee;
}

.contents__inner h2 {
	padding: 10px;
	font-size: 20px;
	font-weight: bold;
	border-bottom: 1px solid #666;
}

.btn__box {
	text-align: center;
}

.btn__box a {
	display: inline-block;
	width: 250px;
	height: 50px;
	margin: 0 auto;
	line-height: 50px;
	font-size: 13px;
	color: #000;
	border: 1px solid #000;
}

/* --------------------------------------------------- checkbox */
.check {
	display: none;
}

.switch {
	position: fixed;
	left: 0;
	right: 0;
	width: 300px;
	height: 140px;
	margin: auto;
	font-size: 80px;
	font-weight: bold;
	text-align: center;
	cursor: pointer;
	text-shadow: 5px 5px 10px rgba(0,0,0,.8);
	color: #fff;
	-webkit-transition: all .5s;
	transition: all .5s;
	visibility: visible;
	opacity: 1;
	z-index: 2;
}

.switch.slide {
	top: 10%;
}
.switch.slide::before {
	content: 'slide';
	-webkit-transition: all .5s;
	transition: all .5s;
}

.switch.fade {
	top: 30%;
}
.switch.fade::before {
	content: 'fade';
	-webkit-transition: all .5s;
	transition: all .5s;
}

.switch.push {
	top: 50%;
}
.switch.push::before {
	content: 'push';
	-webkit-transition: all .5s;
	transition: all .5s;
}

.switch.pull {
	top: 70%;
}
.switch.pull::before {
	content: 'pull';
	-webkit-transition: all .5s;
	transition: all .5s;
}

.check.slide:checked ~ .switch.slide::before,
.check.fade:checked ~ .switch.fade::before,
.check.push:checked ~ .switch.push::before,
.check.pull:checked ~ .switch.pull::before {
	content: 'close';
	opacity: .3;
}
.check.slide:checked ~ .switch.push,
.check.slide:checked ~ .switch.fade,
.check.slide:checked ~ .switch.pull,
.check.fade:checked ~ .switch.slide,
.check.fade:checked ~ .switch.push,
.check.fade:checked ~ .switch.pull,
.check.push:checked ~ .switch.slide,
.check.push:checked ~ .switch.fade,
.check.push:checked ~ .switch.pull,
.check.pull:checked ~ .switch.slide,
.check.pull:checked ~ .switch.fade,
.check.pull:checked ~ .switch.push {
	visibility: hidden;
	opacity: 0;
}

.check.slide:checked ~ .gatefold::before {
	-webkit-transform: translate3d(-550px,0,0);
	transform: translate3d(-550px,0,0);
}
.check.slide:checked ~ .gatefold::after {
	-webkit-transform: translate3d(550px,0,0);
	transform: translate3d(550px,0,0);
}

.check.fade:checked ~ .gatefold::before {
	-webkit-transform: translate3d(-550px,0,0);
	transform: translate3d(-550px,0,0);
	opacity: 0;
}
.check.fade:checked ~ .gatefold::after {
	-webkit-transform: translate3d(550px,0,0);
	transform: translate3d(550px,0,0);
	opacity: 0;
}

.check.push ~ .gatefold::before,
.check.pull ~ .gatefold::before {
	-webkit-transform-origin: left center;
	-ms-transform-origin: left center;
	transform-origin: left center;
}
.check.push ~ .gatefold::after,
.check.pull ~ .gatefold::after {
	-webkit-transform-origin: right center;
	-ms-transform-origin: right center;
	transform-origin: right center;
}

.check.push:checked ~ .gatefold::before {
	-webkit-transform: perspective(1500px) rotateY(50deg);
	transform: perspective(1500px) rotateY(50deg);
}
.check.push:checked ~ .gatefold::after {
	-webkit-transform: perspective(1500px) rotateY(-50deg);
	transform: perspective(1500px) rotateY(-50deg);
}

.check.pull:checked ~ .gatefold::before {
	-webkit-transform: perspective(1500px) rotateY(-80deg);
	transform: perspective(1500px) rotateY(-80deg);
}
.check.pull:checked ~ .gatefold::after {
	-webkit-transform: perspective(1500px) rotateY(80deg);
	transform: perspective(1500px) rotateY(80deg);
}
				</code></pre>
			</section>
		</main>
		<footer class="footer">
			<p class="btn__box"><a href="http://theorthodoxworks.com/web-design/in-half-the-image-only-css/" target="_blank">このデモのエントリーへ</a></p>
		</footer>
	</div>
</body>
              
            
!

CSS

              
                /* gatefold */
.gatefold {
	width: 100%;
	height: 100%;
}

.gatefold::before,
.gatefold::after {
	content: '';
	position: fixed;
	top: 0;
	width: 100%;
	height: 100vh;
	background: url(http://theorthodoxworks.com/demo/images/gatefold.jpg) top center no-repeat;
	background-size: cover;
	-webkit-transition: all 1s;
	transition: all 1s;
	z-index: 1;
}

.gatefold::before {
	left: 0;
	clip: rect(0px 50vw 100vh 0px);
}

.gatefold::after {
	right: 0;
	clip: rect(0px 100vw 100vh 50vw);
}

/* contents */
.header,
.contents,
.footer {
	max-width: 1000px;
	margin: 0 auto;
	padding: 80px 0;
	text-align: center;
}

.contents {
	padding: 0;
}

.contents__inner {
	box-sizing: border-box;
	max-width: 680px;
	height: 100%;
	margin: 40px auto 0;
	padding: 20px;
	text-align: left;
	background: #eee;
}

.contents__inner h2 {
	padding: 10px;
	font-size: 20px;
	font-weight: bold;
	border-bottom: 1px solid #666;
}

.btn__box {
	text-align: center;
}

.btn__box a {
	display: inline-block;
	width: 250px;
	height: 50px;
	margin: 0 auto;
	line-height: 50px;
	font-size: 13px;
	color: #000;
	border: 1px solid #000;
}

/* checkbox */
.check {
	display: none;
}

.switch {
	position: fixed;
	left: 0;
	right: 0;
	width: 300px;
	height: 140px;
	margin: auto;
	font-size: 80px;
	font-weight: bold;
	text-align: center;
	cursor: pointer;
	text-shadow: 5px 5px 10px rgba(0,0,0,.8);
	color: #fff;
	-webkit-transition: all .5s;
	transition: all .5s;
	visibility: visible;
	opacity: 1;
	z-index: 2;
}

.switch.slide {
	top: 10%;
}
.switch.slide::before {
	content: 'slide';
	-webkit-transition: all .5s;
	transition: all .5s;
}

.switch.fade {
	top: 30%;
}
.switch.fade::before {
	content: 'fade';
	-webkit-transition: all .5s;
	transition: all .5s;
}

.switch.push {
	top: 50%;
}
.switch.push::before {
	content: 'push';
	-webkit-transition: all .5s;
	transition: all .5s;
}

.switch.pull {
	top: 70%;
}
.switch.pull::before {
	content: 'pull';
	-webkit-transition: all .5s;
	transition: all .5s;
}

.check.slide:checked ~ .switch.slide::before,
.check.fade:checked ~ .switch.fade::before,
.check.push:checked ~ .switch.push::before,
.check.pull:checked ~ .switch.pull::before {
	content: 'close';
	opacity: .3;
}
.check.slide:checked ~ .switch.push,
.check.slide:checked ~ .switch.fade,
.check.slide:checked ~ .switch.pull,
.check.fade:checked ~ .switch.slide,
.check.fade:checked ~ .switch.push,
.check.fade:checked ~ .switch.pull,
.check.push:checked ~ .switch.slide,
.check.push:checked ~ .switch.fade,
.check.push:checked ~ .switch.pull,
.check.pull:checked ~ .switch.slide,
.check.pull:checked ~ .switch.fade,
.check.pull:checked ~ .switch.push {
	visibility: hidden;
	opacity: 0;
}

.check.slide:checked ~ .gatefold::before {
	-webkit-transform: translate3d(-550px,0,0);
	transform: translate3d(-550px,0,0);
}
.check.slide:checked ~ .gatefold::after {
	-webkit-transform: translate3d(550px,0,0);
	transform: translate3d(550px,0,0);
}

.check.fade:checked ~ .gatefold::before {
	-webkit-transform: translate3d(-550px,0,0);
	transform: translate3d(-550px,0,0);
	opacity: 0;
}
.check.fade:checked ~ .gatefold::after {
	-webkit-transform: translate3d(550px,0,0);
	transform: translate3d(550px,0,0);
	opacity: 0;
}

.check.push ~ .gatefold::before,
.check.pull ~ .gatefold::before {
	-webkit-transform-origin: left center;
	-ms-transform-origin: left center;
	transform-origin: left center;
}
.check.push ~ .gatefold::after,
.check.pull ~ .gatefold::after {
	-webkit-transform-origin: right center;
	-ms-transform-origin: right center;
	transform-origin: right center;
}

.check.push:checked ~ .gatefold::before {
	-webkit-transform: perspective(1500px) rotateY(50deg);
	transform: perspective(1500px) rotateY(50deg);
}
.check.push:checked ~ .gatefold::after {
	-webkit-transform: perspective(1500px) rotateY(-50deg);
	transform: perspective(1500px) rotateY(-50deg);
}

.check.pull:checked ~ .gatefold::before {
	-webkit-transform: perspective(1500px) rotateY(-80deg);
	transform: perspective(1500px) rotateY(-80deg);
}
.check.pull:checked ~ .gatefold::after {
	-webkit-transform: perspective(1500px) rotateY(80deg);
	transform: perspective(1500px) rotateY(80deg);
}
              
            
!

JS

              
                
              
            
!
999px

Console