HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
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.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
#wrap
-7.times do
%input.trigger{:name => "rad", :type => "radio"}/
%input.trigger{:checked => "checked", :name => "rad", :type => "radio"}/
.innerwrap
-8.times do
%input{:type => "checkbox"}/
.cards
.cardwrap
.card
.inner
%h1 <span>Hey Now</span>Somebody
.text
%p Well the years start coming and they don't stop coming
.link
%p Fed to the rules and I hit the ground running
.cardwrap
.card
.inner
%h1 <span>You're an All-Star</span>once told
.text
%p Didn't make sense not to live for fun
.link
%p Your brain gits smart but your head gits dumb
.cardwrap
.card
.inner
%h1 <span>Get your game on</span>me the world
.text
%p So much to do, so much to see
.link
%p So what's wrong with taking the back streets?
.cardwrap
.card
.inner
%h1 <span>go play</span>was gonna
.text
%p You'll never know if you don't go You'll never shine if you don't glow
.link
%p It's a cool place and they say it gits colder
.cardwrap
.card
.inner
%h1 <span>Hey Now</span>roll me
.text
%p You're bundled up now, wait till you git older But the meteor men beg to differ
.link
%p Judging by the hole in the satellite picture
.cardwrap
.card
.inner
%h1 <span>you're a rockstar</span>I ain't the
.text
%p The ice we skate is getting pretty thin
.link
%p The water's getting warm so you might as well swim
.cardwrap
.card
.inner
%h1 <span>get the show on</span>sharpest tool
.text
%p My world's on fire, how about yours? That's the way I like it and I never get bored
.link
%p Somebody once asked could I spare some change for gas?
.cardwrap
.card
.inner
%h1 <span>get paid</span>in the shed
.text
%p I need to get myself away from this place I said yep what a concept
.link
%p I could use a little fuel myself And we could all use a little change
$b: #32cbfb;
$w: #fff;
$g: #e4e2e5;
$r: #fc3359;
$y: #fefb3a;
$bl: #222;
$t: rgba(255,255,255,0.00001);
body{
display:flex;
justify-content:center;
align-items:center;
height:100vh;
overflow:hidden;
background:$g;
#wrap{
width:800px;
height:500px;
box-shadow:0 20px 30px -5px rgba(0,0,0,0.15);
overflow:hidden;
position:relative;
transform-style:preserve-3d;
background:linear-gradient(to bottom, $w 50%, $g 50%);
.trigger{
position:absolute;
width:5%;
height:100%;
bottom:0;
right:0;
z-index:99;
opacity:1;
cursor:pointer;
&:before{
content:'';
position:absolute;
width:100%;
height:100%;
top:0;
left:0;
background:$w;
box-shadow:-1px 0 0 0 rgba(0,0,0,0.015);
transition:0.2s ease-in-out;
}
&:after{
content:'';
position:absolute;
width: 0;
height: 0;
border-style: solid;
border-width: 20px 0 20px 20px;
border-color: transparent transparent transparent $bl;
top:calc(50% - 20px);
right:8.5px;
transition:0.2s ease-in-out;
opacity:0;
}
@for $j from 1 through 8{
&:first-of-type{
&:checked{
& ~ .innerwrap{
.cards{
.cardwrap{
&:first-of-type{
opacity:0;
}
}
}
}
}
}
&:nth-of-type(8){
&:checked{
& ~ .innerwrap{
.cards{
.cardwrap{
&:last-of-type{
opacity:0;
}
}
}
}
}
}
&:nth-of-type(#{$j}){
&:after{
opacity:1;
}
&:hover{
&:after{
border-color: transparent transparent transparent $w;
}
&:before{
background:$bl;
}
}
&:checked{
pointer-events:none;
transform:translateX(#{$j * 100%});
& ~ .trigger{
transform:translateX(#{$j * 0%});
z-index:#{99 - $j};
}
& ~ .innerwrap{
.cards{
transform:rotate(#{($j - 1) * 45}deg);
}
input{
@for $i from 1 through 8{
&:nth-of-type(#{$i}){
transform:rotate(#{((($i - 2) + $j) * 45) + 45}deg)
}
}
}
.cardwrap{
@for $i from 1 through 8{
&:last-of-type{
opacity:1;
}
&:nth-of-type(#{$i}){
.card{
transform:rotate(#{(($i - 1) + $j) * -45}deg);
}
}
}
}
}
}
}
}
}
.innerwrap{
position:absolute;
width:1300px;
height:1300px;
left:-725px;
top:-400px;
z-index:999;
input{
position:absolute;
top:calc(50% - 175px);
height:350px;
width:280px;
left:900px;
transform-style:preserve-3d;
transform-origin:-350px;
perspective:600px;
z-index:7;
opacity:0;
cursor:pointer;
&:before{
content:'';
position:absolute;
width:100%;
height:100%;
left:0%;
top:0%;
z-index:9;
pointer-events:none;
}
@for $i from 1 through 8{
&:nth-of-type(#{$i}){
&:checked{
&:before{
width:500%;
left:-125%;
height:500%;
top:-125%;
pointer-events:auto;
}
&:hover{
& ~ .cards{
.cardwrap{
&:nth-of-type(#{$i}){
.inner{
.text{
&:before{
animation:turn 0.25s ease-in-out infinite alternate;
@keyframes turn{
from{
transform:rotate(-5deg);
}
to{
transform:rotate(5deg);
}
}
}
}
}
}
}
}
}
& ~ .cards{
.cardwrap{
z-index:-1;
.card{
.inner{
transform:rotateX(0deg) translateZ(-100px) scale(0.95) translateY(-30px) translateX(-50px);
.text, .link{
p{
transform:translateY(0px) skewY(0deg);
transition-delay:0.8s;
}
}
.link{
p{
transition-delay:1s;
}
}
}
}
&:nth-of-type(#{$i}){
z-index:2;
.card{
.inner{
transform:rotateX(0deg) translateZ(150px) translateY(-20px) translateX(-70px);
box-shadow:0 20px 20px 0 rgba(0,0,0,0.25);
.text, .link{
transition:opacity 0s ease-in-out, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease-in-out;
transition-delay:0.3s, 0.6s, 0s;
transform:translateX(150%) rotateX(0deg);
box-shadow:inherit;
opacity:1;
}
.link{
transition-delay:0.3s, 0.75s, 0s;
p{
&:before{
transition-delay:0.95s;
}
}
}
&:after{
transform:skewX(0deg) translateZ(-1px) scale(1);
}
&:before{
transform:translateZ(20px);
}
}
}
}
}
}
}
transform:rotate(#{($i - 1) * 45}deg);
transition:0.7s cubic-bezier(1, 0, 0, 1);
}
}
}
.cards{
position:absolute;
width:100%;
height:100%;
left:-100px;
top:0;
transition:0.7s cubic-bezier(1, 0, 0, 1);
}
.cardwrap{
position:absolute;
top:calc(50% - 150px);
height:300px;
width:250px;
left:1000px;
transform-style:preserve-3d;
transform-origin:-350px;
perspective:800px;
transition:0.7s cubic-bezier(1, 0, 0, 1);
@for $i from 1 through 8{
&:last-of-type{
opacity:0;
}
&:nth-of-type(1n){
.card{
.inner{
background:$b;
}
}
}
&:nth-of-type(2n){
.card{
.inner{
background:$r;
}
}
}
&:nth-of-type(3n){
.card{
.inner{
background:$y;
}
}
}
&:nth-of-type(#{$i}){
transform:rotate(#{($i) * 45}deg);
.card{
transform:rotate(#{($i) * -45}deg);
transition:0.7s cubic-bezier(1, 0, 0, 1);
.inner{
position:absolute;
width:112.5%;
height:112.5%;
left:-0.675%;
top:-0.675%;
background:$r;
transform-style:preserve-3d;
transform-origin:bottom;
transform:rotateX(-30deg) translateZ(-100px);
transition:0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
pointer-events:none;
display:flex;
padding:25px 25px 40px 25px;
box-sizing:border-box;
align-items:flex-end;
flex-wrap:wrap;
h1{
font-family:'Anton';
text-transform:uppercase;
letter-spacing:1px;
font-size:40px;
transform:translateZ(25px);
position:relative;
color:$bl;
span{
position:absolute;
font-size:12px;
top:-30px;
left:0;
padding:5px;
background:$bl;
color:$w;
}
}
&:before{
content:'0#{$i}';
left:25px;
top:25px;
font-size:75px;
color:#bl;
font-family:'Anton';
position:absolute;
transform:translateZ(1px);
}
&:after{
content:'';
position:absolute;
width:100%;
height:75%;
bottom:0;
left:0;
background:linear-gradient(to bottom, rgba(0,0,0,0.00001), rgba(0,0,0,0.1));
transform-origin:bottom;
transform-style:preserve-3d;
z-index:-1;
transform:skewX(-10deg) translateZ(-1px) scale(1);
transition:0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.text{
&:before{
content:'';
position:absolute;
width:30px;
height:30px;
border-radius:100%;
background:linear-gradient(45deg, $t calc(50% - 2px), $w calc(50% - 2px), $w calc(50% + 2px), $t calc(50% + 2px)), linear-gradient(-45deg, $t calc(50% - 2px), $w calc(50% - 2px), $w calc(50% + 2px), $t calc(50% + 2px)), $r;
z-index:999;
top:10px;
right:10px;
box-shadow:inset 0 0 0 5px $r;
transition:0.2s ease-in-out;
}
}
.text, .link{
box-sizing:border-box;
position:absolute;
width:70%;
height:60%;
left:0;
top:0;
background:$bl;
transition:0.2s cubic-bezier(0.175, 0.885, 0.32, 1);
transform:translateX(150%) rotateX(90deg);
opacity:0;
transform-origin:bottom;
color:$w;
padding:25px;
display:flex;
align-items:center;
text-transform:uppercase;
overflow:hidden;
p{
font-size:12px;
margin-top:0;
line-height:1.5;
position:relative;
font-family:"Raleway";
transition:0.4s cubic-bezier(0.175, 0.885, 0.32, 1);
transform:translateY(200px) skewY(20deg);
}
}
.link{
transform-origin:top;
height:calc(40% - 15px);
top:calc(60% + 15px);
background:$w;
color:$bl;
transform:translateX(150%) rotateX(-90deg);
p{
transform:translateY(200px) skewY(-20deg);
}
}
}
}
}
}
.card{
position:absolute;
left:0;
top:0;
width:100%;
height:100%;
transform-style:preserve-3d;
}
}
}
}
}
Also see: Tab Triggers