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.
.ui
.ui_inner
.ui_fruit
%img{:src => 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/217233/treats.png'}
.ui_basket
Basket
%i.fa.fa-shopping-cart
.ui_inner__selection
%input{:id => 'lovely', :type => 'radio', :name => 'selection', :checked => 'checked'}
%label{:for => 'lovely'}
.selected.l Lovely cupcake
.ui_inner__slider
.sb
%img{:src => 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/217233/starburst2.png'}
.slide
.slide_inner
.slide_inner__left
%img{:src => 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/217233/cupcake1.png'}
.firework
-(1..70).each do
.firework_part
.slide_inner__right
%h2 Lovely cupcake
%h3 $4.99 <span> Pack of 10</span>
%p Pie cupcake caramels marshmallow ice cream icing. Brownie biscuit candy macaroon dessert ice cream halvah. Cheesecake sweet roll marzipan brownie lollipop gummies.
%input{:type => 'text',:value => '10'}
%input.hid{:type => 'checkbox', :id => 'add'}
%label{:for => 'add'}
%div.add
Add to cart
.firework
-(1..30).each do
.firework_part
%input{:id => 'super', :type => 'radio', :name => 'selection'}
%label{:for => 'super'}
.selected.s Super cupcake
.ui_inner__slider
.sb
%img{:src => 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/217233/starburst2.png'}
.slide
.slide_inner
.slide_inner__left
%img{:src => 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/217233/cupcake2.png'}
.firework
-(1..70).each do
.firework_part
.slide_inner__right
%h2 Super cupcake
%h3 $4.99 <span> Pack of 10</span>
%p Pie cupcake caramels marshmallow ice cream icing. Brownie biscuit candy macaroon dessert ice cream halvah. Cheesecake sweet roll marzipan brownie lollipop gummies.
%input{:type => 'text',:value => '10'}
%input.hid{:type => 'checkbox', :id => 'add2'}
%label{:for => 'add2'}
%div.add
Add to cart
.firework
-(1..30).each do
.firework_part
%input{:id => 'mega', :type => 'radio', :name => 'selection'}
%label{:for => 'mega'}
.selected.m Mega cupcake
.ui_inner__slider
.sb
%img{:src => 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/217233/starburst2.png'}
.slide
.slide_inner
.slide_inner__left
%img{:src => 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/217233/cupcake3.png'}
.firework
-(1..70).each do
.firework_part
.slide_inner__right
%h2 Mega cupcake
%h3 $4.99 <span> Pack of 10</span>
%p Pie cupcake caramels marshmallow ice cream icing. Brownie biscuit candy macaroon dessert ice cream halvah. Cheesecake sweet roll marzipan brownie lollipop gummies.
%input{:type => 'text',:value => '10'}
%input.hid{:type => 'checkbox', :id => 'add3'}
%label{:for => 'add3'}
%div.add
Add to cart
.firework
-(1..30).each do
.firework_part
%input{:id => 'huge', :type => 'radio', :name => 'selection'}
%label{:for => 'huge'}
.selected.h Huge cupcake
.ui_inner__slider
.sb
%img{:src => 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/217233/starburst2.png'}
.slide
.slide_inner
.slide_inner__left
%img{:src => 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/217233/cupcake4.png'}
.firework
-(1..70).each do
.firework_part
.slide_inner__right
%h2 Huge cupcake
%h3 $9.99 <span> Pack of 10</span>
%p Pie cupcake caramels marshmallow ice cream icing. Brownie biscuit candy macaroon dessert ice cream halvah. Cheesecake sweet roll marzipan brownie lollipop gummies.
%input{:type => 'text',:value => '10'}
%input.hid{:type => 'checkbox', :id => 'add4'}
%label{:for => 'add4'}
%div.add
Add to cart
.firework
-(1..30).each do
.firework_part
@import 'https://fonts.googleapis.com/css?family=Amatic+SC|Bad+Script|Satisfy|Shadows+Into+Light|Yellowtail';
$width: 600;
* {
box-sizing: border-box;
}
i {
font-family: 'font-awesome';
}
body {
overflow: hidden;
background-image: url(https://www.toptal.com/designers/subtlepatterns/patterns/food.png);
font-family: 'Amatic SC', cursive;
.ui {
width: $width + px;
position: absolute;
left: 0;
right: 0;
margin: auto;
top: 50%;
transform: translateY(-50%);
&_fruit {
position: absolute;
z-index: 34;
right: -47px;
pointer-events: none;
top: 180px;
img {
width: 344px;
}
}
&_basket {
color: #de467c;
position: relative;
top: -6px;
text-align: right;
}
&_inner {
height: 340px;
background-image: -webkit-linear-gradient(45deg, #ffffff 0%, #f3f3f3 100%);
padding: 40px;
box-shadow: 0px 2px 40px 0px transparent, 0px 6px 26px 0px rgb(191, 155, 89), 0px 3px 0px -2px white inset, 0px 22px 60px 70px #f1f1f1 inset, 0px 8px 18px -7px transparent, 30px 13px 30px 28px #b18f8f inset;
.sb {
overflow: hidden;
width: 450px;
top: -1px;
left: -171px;
position: absolute;
height: 480px;
animation: spin 14s infinite linear;
img {
width: 450px;
opacity: 0;
transition: all .15s .0s
}
}
&__selection {
label {
.ui_inner__slider {
//display:none;
//position: absolute;
}
%selected {
background: #de467c;
position: absolute;
right: -130px;
cursor: pointer;
width: 130px;
color: white;
padding: 20px;
font-size: 14px;
z-index: 4;
font-family: 'Bad Script', cursive;
top: 0;
text-align: center;
transition: all .2s;
&:hover {
background: #94619c;
padding: 20px 20px 20px 30px;
}
}
.m,
.s,
.l,
.h {
@extend %selected;
border-radius: 255px 15px 205px 35px/35px 225px 35px 255px;
}
.l {
top: 0px;
border-radius: 265px 35px 185px 14px/8px 235px 12px 255px;
width: 126px;
right: -119px;
box-shadow: 0px 1px 0px 0px rgba(255, 255, 255, 0.06) inset;
&:before {
content: '';
display: block;
background: #f1f1f1;
height: 100px;
width: 10px;
position: ABSOLUTE;
LEFT: -3PX;
top: 0px;
}
}
.s {
top: 63px;
border-radius: 195px 35px 155px 3px/19px 265px 25px 235px;
width: 127px;
right: -123px;
&:before {
content: '';
display: block;
background: #f1f1f1;
height: 100px;
width: 10px;
position: ABSOLUTE;
LEFT: -6PX;
top: 0px;
}
}
.h {
top: 187px;
border-radius: 195px 9px 177px 3px/49px 275px 65px 235px;
width: 127px;
right: -123px;
&:before {
content: '';
display: block;
background: #f1f1f1;
height: 100px;
width: 10px;
position: ABSOLUTE;
LEFT: -6PX;
top: 0px;
}
}
.m {
top: 127px;
border-radius: 265px 15px 205px 1px/0px 225px 35px 245px;
right: -125px;
box-shadow: 0px 1px 0px 0px rgba(255, 255, 255, 0.06) inset;
&:before {
content: '';
display: block;
background: #f1f1f1;
height: 100px;
width: 10px;
position: ABSOLUTE;
LEFT: -5PX;
top: 0px;
}
}
}
input[type="radio"] {
display: none;
}
input[type="radio"]:checked + label {
.selected {
background: #d02562 !important
}
}
input[type="radio"]:checked + label .ui_inner__slider .sb img {
opacity: 0.3;
transition: all 1s .2s
}
input[type="radio"]:checked + label .ui_inner__slider .slide_inner__left {
opacity: 1;
left: -100px;
transition: all .5s .35s cubic-bezier(0.175, 1.605, 0.455, 0.920);
}
input[type="radio"]:checked + label .ui_inner__slider .slide_inner__right h2 {
opacity: 1;
left: 0px;
transition: all .5s .4s cubic-bezier(0.175, 1.605, 0.455, 0.920);
}
input[type="radio"]:checked + label .ui_inner__slider .slide_inner__right h3 {
opacity: 1;
left: 0px;
transition: all .5s .45s cubic-bezier(0.175, 1.605, 0.455, 0.920);
}
input[type="radio"]:checked + label .ui_inner__slider {
pointer-events: all
}
input[type="radio"]:checked + label .ui_inner__slider .slide_inner__right p {
opacity: 1;
left: 0px;
transition: all .5s .50s cubic-bezier(0.175, 1.605, 0.455, 0.920);
}
input[type="radio"]:checked + label .ui_inner__slider .slide_inner__right input {
position: relative;
opacity: 1;
left: 0px;
transition: all .5s .55s cubic-bezier(0.175, 1.605, 0.455, 0.920);
}
input[type="radio"]:checked + label .ui_inner__slider .slide_inner__right .add {
position: relative;
opacity: 1;
left: 0px;
transition: all .5s .6s cubic-bezier(0.175, 1.605, 0.455, 0.920);
}
input[type="radio"]:checked + label .ui_inner__slider .slide_inner__left .firework .firework {
&_part {
@for $i from 1 through 70 {
&:nth-of-type(#{$i}) {
left: random(230) - 230 + px;
top: random(230) - 230 + px;
opacity: 0;
transform: rotate(random(1200) - 600 + 0deg) !important;
}
}
}
}
input[type="checkbox"]:checked + label .add .firework {
&_part {
@for $i from 1 through 70 {
&:nth-of-type(#{$i}) {
left: 277px;
top: -186px;
opacity: 1;
transform: rotate(random(1200) - 600 + 0deg) !important;
}
}
}
}
}
.ui_inner__slider {
pointer-events: none;
.slide {
&_inner {
position: absolute;
top: 54px;
text-align: right;
&__left {
display: inline-block;
width: 42%;
opacity: 0;
position: absolute;
left: -220px;
top: 10px;
-webkit-transition: all .5s 0s cubic-bezier(0.175, 1.605, 0.455, 0.920);
img {
width: 100%;
z-index: 8;
position: Relative;
filter: drop-shadow(-4px 6px 6px rgba(0, 0, 0, 0.2))
}
.firework {
position: relative;
left: 130px;
top: -150px;
// z-index: 8;
&_part {
position: absolute;
border-radius: 10px;
background: Red;
transition: left .99s .36s cubic-bezier(0.230, 1.000, 0.320, 1.000), transform .6s .36s, top .99s .36s cubic-bezier(0.330, 1.000, 0.320, 1.000), opacity .99s .55s;
left: 0;
top: 0;
opacity: 1;
@for $i from 1 through 70 {
&:nth-of-type(#{$i}) {
background: adjust-hue(#de467c, random(80));
height: random(15) - 5 + px;
width: 5px;
transform: rotate(0deg);
}
}
}
}
}
&__right {
display: inline-block;
width: 70%;
padding: 0px 40px 0px 0px;
text-align: left;
position: relative;
z-index: 1;
.hid {
display: none;
}
h2 {
margin: 0px 0px 10px 0px;
font-family: 'Amatic SC', cursive;
color: #94619c;
font-size: 32px;
position: relative;
opacity: 0;
left: -90px;
transition: all .5s .2s cubic-bezier(0.175, 1.605, 0.455, 0.920);
}
h3 {
margin: 0px 0px 10px 0px;
font-family: 'Satisfy', cursive;
color: #de467c;
font-size: 20px;
position: relative;
opacity: 0;
left: -90px;
transition: all .5s .25s cubic-bezier(0.175, 1.605, 0.455, 0.920);
span {
font-size: 11px;
}
}
p {
margin: 0;
font-family: 'Bad Script', cursive;
line-height: 22px;
color: #9e9da7;
font-size: 12px;
position: relative;
opacity: 0;
left: -90px;
transition: all .5s .3s cubic-bezier(0.175, 1.605, 0.455, 0.920);
}
input {
margin: 20px 0px;
padding: 10px;
outline: none;
border-radius: 255px 15px 205px 35px/35px 225px 35px 255px;
font-family: 'Satisfy', cursive;
border: 3px solid #e8e8e8;
color: #de467c;
width: 55px;
text-align: Center;
position: relative;
opacity: 0;
left: -40px;
transition: all .5s .35s cubic-bezier(0.175, 1.605, 0.455, 0.920);
}
.add {
cursor: pointer;
input {
display: none;
}
display: inherit;
margin: 20px 0px;
padding: 10px 20px;
margin-left: 10px;
border-radius: 255px 15px 205px 35px/35px 225px 35px 255px;
font-family: 'Amatic SC',
cursive;
background: #de467c;
color: white;
width: 25px;
text-align: Center;
text-decoration: none;
position: relative;
opacity: 0;
left: -40px;
transition: all .5s .4s cubic-bezier(0.175, 1.605, 0.455, 0.920);
.firework {
position: absolute;
left: 0px;
top: 0px;
// z-index: 8;
&_part {
position: absolute;
border-radius: 10px;
left: 0;
top: 0;
opacity: 1;
@for $i from 1 through 40 {
&:nth-of-type(#{$i}) {
background: #de467c;
height: 5px;
width: 5px;
opacity: 0;
left: random(50) - 40 + px;
top: random(20) - 10 + px;
transform: rotate(0deg);
transition: left (random(170) - 30)/100 + 0s $i / 80 + 0s cubic-bezier(0.230, 1.000, 0.320, 1.000), transform .6s $i / 80 + 0s, top .99s $i / 80 + 0s cubic-bezier(0.330, 1.000, 0.320, 1.000), opacity .3s .2 + 0s;
}
}
}
}
}
}
}
}
}
}
}
}
@keyframes spin {
to {
transform: rotate(360deg)
}
}
Also see: Tab Triggers