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 URL's 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 it's URL and the proper URL extention.
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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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.
<input type="checkbox" />
<div class="burger">
<div></div>
</div>
<div id="wrap">
<h1><span>Bertie's</span><strong>Big</strong><span>Burgers</span></h1>
<nav class="menu">
<ul>
<li>Locations & Hours
<ul>
<li>New York City</li>
<li>Chicago</li>
<li>San Francisco</li>
<li>Los Angeles</li>
<li>Philadelphia</li>
<li>Toronto</li>
<li>Vancouver</li>
</ul>
</li>
<li>Menu
<ul>
<li>Burgers
<ul>
<li>The Big Cheese</li>
<li>The Big Veg</li>
<li>The Double Big-Big</li>
<li>The Big Boss</li>
<li>The Little Big</li>
</ul>
</li>
<li>Fries
<ul>
<li>Classic Fries</li>
<li>Seasoned Fries</li>
<li>Curly Fries</li>
<li>Tater Tots</li>
</ul>
</li>
<li>Salads
<ul>
<li>The Big 'Burg</li>
<li>The Big Ceasar</li>
<li>The Giant Garden</li>
</ul>
</li>
<li>Shakes
<ul>
<li>Big Vanilla</li>
<li>Big Chocolate</li>
<li>Big Strawberry</li>
<li>Big Cookies & Creme</li>
</ul>
</li>
</ul>
</li>
<li>Takeout & Delivery</li>
<li>Catering</li>
<li>Join the Big Burger Club</li>
</ul>
</nav>
<section class="article">
<div>
<img src="https://assets.codepen.io/t-1/lefteris-kallergis-_TLKIVSW6Do-unsplash.jpg" alt="a vegetarian burger with a quinoa patty and lots of vegetable fixins.">
<!-- photo by Lefteris kallergis for Unsplash. Full-size image at: https://unsplash.com/photos/_TLKIVSW6Do -->
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Qui dicta minus molestiae vel beatae natus eveniet ratione temporibus aperiam harum alias officiis assumenda officia quibusdam deleniti eos cupiditate dolore doloribus!</br></br>Ad dolore dignissimos asperiores dicta facere optio quod commodi nam tempore recusandae. Rerum sed nulla eum vero expedita ex delectus voluptates rem at neque quos facere sequi unde optio aliquam!</p>
</div>
<div>
<img src="https://assets.codepen.io/t-1/jay-gajjar-vsYCZVef28E.jpg" alt="french fries seasoned with garlic and spices in a brown craft paper container. ">
<!-- photo by Jay Gajjar for Unsplash. Full-size image at: https://unsplash.com/photos/vsYCZVef28E -->
<p>Tenetur quod quidem in voluptatem corporis dolorum dicta sit pariatur porro quaerat autem ipsam odit quam beatae tempora quibusdam illum! Modi velit odio nam nulla unde amet odit pariatur at!</p>
</div>
<div>
<img src="https://assets.codepen.io/t-1/melissa-walker-horn-NkwNp3ho-Qw-unsplash.jpg" alt="a burger, fries, and a beer on a restaurant table. ">
<!-- photo by Melissa Walker Horn for Unsplash. Full size image at: https://unsplash.com/photos/NkwNp3ho-Qw -->
<p>Consequatur rerum amet fuga expedita sunt et tempora saepe? Iusto nihil explicabo perferendis quos provident delectus ducimus necessitatibus reiciendis optio tempora unde earum doloremque commodi laudantium ad nulla vel odio?</p>
</div>
</section>
</div>
@import url("https://fonts.googleapis.com/css2?family=Oswald:wght@400;600&display=swap");
@font-face {
font-family: "Bogart";
src: url("https://assets.codepen.io/383755/bogart-semibold.woff2")
format("woff");
}
html {
padding: 0;
margin: 0;
}
body {
font-family: "Oswald";
--bl: #342935;
--p: #b161c7;
--r: #fd6262;
--b: #55c6d9;
--y: #fccf08;
--w: #f2fdff;
--bl: #322d2f;
--b: #dd6235;
--y: #cbaf69;
--r: #dd6235;
padding: 0;
margin: 0;
--expo: cubic-bezier(1, 0, 0, 1);
--elastic: cubic-bezier(0.375, 0.885, 0.32, 1.125);
background: var(--w);
#wrap {
perspective: 80vmin;
perspective-origin: 50% 0vh;
position: fixed;
overflow: hidden;
height: 100vh;
}
* {
box-sizing: border-box;
transform-style: preserve-3d;
backface-visibility: hidden;
}
input,
.burger {
cursor: pointer;
transform: scale(0.5) translateZ(10vmin);
}
input,
.burger {
position: fixed;
top: 0vmin;
right: 3vmin;
z-index: 20;
width: 7vmin;
height: 7vmin;
opacity: 0;
&:hover {
& ~ .burger {
> div {
background-position: 50% 50%;
transition: background-position 0.3s var(--expo) 0s;
&:before,
&:after {
background-position: 100% 50%;
}
}
}
}
&:checked {
& ~ .burger {
background: var(--bl);
box-shadow: 0 0 0 2vmin var(--bl);
transition: 0s ease-in-out 1.25s, box-shadow 0.5s var(--expo) 1.25s;
> div {
background-position: 100% 50%;
transition: background-position 0.3s var(--expo) 0s;
&:before,
&:after {
background: var(--y);
transform: translate(1vmin, 5.25vmin) rotate(-45deg);
transition: transform 0.4s var(--elastic) 0.75s,
background 0.75s ease-in-out;
}
&:after {
transform: translate(-1vmin, 0vmin) rotate(45deg);
}
}
}
& ~ #wrap {
nav {
> ul {
padding: 6vmin 6vmin;
box-shadow: inset 0 0 0 calc(6vmin - 2px) var(--bl),
inset 0 0 0 6vmin var(--w);
transition: 2s ease-in-out 0s;
> li {
padding: 1vmin 3vmin;
}
}
}
section,
nav {
transition: transform 0.75s var(--expo) 0.5s;
div {
img {
box-shadow: 0 0 0 -1vmin var(--w), 0 0 0 calc(-1vmin + 1px) var(--y),
0 5vmin 10vmin -15vmin var(--bl);
filter: saturate(0) blur(4px);
opacity: 0;
transition: 0.3s var(--expo) 0s, opacity 0.5s ease-in-out 0.3s;
}
p {
transition: transform 0.3s var(--expo) 0.3s;
transform-origin: top;
transform: scaleY(0);
&:before {
transition: transform 0.3s var(--expo) 0s;
transform-origin: bottom;
transform: scaleY(1);
}
&:after {
transition: transform 0.5s var(--expo) 0s,
background-size 0.5s var(--expo) 0s;
transform: scaleX(0);
background-size: 0vmin 0vmin, 100% 2px;
}
}
}
> ul {
> li {
&:after {
transition: transform 0.5s var(--expo) 1.75s;
transform: scaleX(1);
}
}
li {
transform: rotateX(0deg) translateZ(0px);
&:before {
transform: scaleX(1);
transition: transform 1s var(--expo);
}
@for $i from 1 through 20 {
&:nth-of-type(#{$i}) {
transition: 0.2s ease-in-out,
transform 0.75s var(--expo) #{$i/15 + 0.75}s;
&:before {
transition-delay: #{$i/15 + 1.5}s;
}
}
}
}
}
}
section {
transform: translateX(-100vw) rotateY(-65deg) skewY(0deg) scaleX(2)
scaleY(7) translateZ(0px);
will-change: transform;
}
h1 {
transform: translateX(-50%) scaleY(7) translateY(-150%) translateZ(0px);
transition: transform 0.3s var(--expo) 0.15s;
&:before {
background-position: 50% 100%;
transition: background-position 0.3s var(--expo) 0.05s;
}
span {
&:first-of-type {
transform: translateX(35%);
}
&:last-of-type {
transform: translateX(-35%);
}
}
strong {
transform: scaleY(10) translateY(-10vmin);
}
}
nav {
transform: rotateX(0deg) translateX(0) skewY(0deg);
}
}
}
}
.burger {
pointer-events: none;
opacity: 1;
transition: 0s ease-in-out;
> div {
position: absolute;
width: 100%;
height: 1vmin;
background: linear-gradient(
to left,
var(--bl) 33%,
var(--r) 33%,
var(--r) 66%,
rgba(255, 255, 255, 0.0001) 66%
);
background-size: 300% 100%;
background-position: 100% 50%;
border-radius: 10vmin;
top: 50%;
transform: translateY(-50%);
transition: background-position 0.3s var(--expo);
&:before,
&:after {
content: "";
position: absolute;
width: 100%;
height: 100%;
background: linear-gradient(to right, var(--bl) 50%, var(--r) 50%);
background-size: 200% 100%;
background-position: 0% 50%;
border-radius: inherit;
top: -2.5vmin;
transition: transform 0.4s ease-in-out 0s,
background-position 0.3s var(--expo);
transform-origin: 0% 0%;
}
&:after {
top: 2.5vmin;
transform-origin: 100% 100%;
}
}
}
h1 {
position: fixed;
top: 0;
left: 50%;
z-index: 2;
font-family: "Bogart";
font-size: 4vmin;
margin: 0;
padding-left: 6vmin;
width: 100vw;
text-align: left;
transform: translateX(-50%) translateZ(0px);
transition: transform 0.5s var(--expo) 0.75s;
transform-origin: bottom;
strong,
span {
display: inline-block;
}
span {
transition: 0.75s var(--expo) 1s;
color: var(--bl);
}
strong {
vertical-align: middle;
font-size: 6vmin;
text-transform: uppercase;
margin: 0 0.5vmin;
transform-origin: bottom;
transition: 0.5s var(--elastic) 1.25s;
color: var(--r);
}
&:before {
content: "";
position: absolute;
width: 100vw;
height: 150%;
top: 0;
left: 50%;
transform: translateX(-50%) translateZ(0px);
z-index: -2;
background: linear-gradient(
to bottom,
var(--w),
rgba(255, 255, 255, 0.0001)
);
}
}
nav,
section,
h1 {
backface-visibility: hidden;
}
h1,
section {
display: inline-block;
transform-origin: top right;
will-change: transform;
}
section {
padding: 10vmin 12vmin 8vmin;
background: radial-gradient(
circle at center,
var(--r) 0.5px,
var(--w) 0.5px,
var(--w) 5px
)
50% 50% / 5px 5px repeat;
color: var(--w);
overflow: scroll;
height: 100vh;
transform: translateZ(0px);
box-shadow: 10vmin 0 0 var(--r);
div {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
padding: 15vmin 0;
position: relative;
--x: 10vmin;
img,
p {
width: 50%;
position: relative;
}
img {
transform: scale(1.25) translateX(var(--x));
filter: saturate(1) blur(0px);
box-shadow: 0 0 0 2.5vmin var(--w), 0 0 0 calc(2.5vmin + 1px) var(--y),
0 5vmin 10vmin -5vmin var(--bl);
opacity: 1;
}
p {
font-size: 2.25vmin;
margin: 0;
z-index: 2;
background: var(--w);
color: var(--bl);
padding: 2rem;
position: relative;
transform: scaleY(1);
transform-origin: bottom;
box-shadow: 0 5vmin 10vmin -7.5vmin var(--bl);
&:before {
content: "";
position: absolute;
width: 100%;
height: 100%;
z-index: 2;
background: var(--r);
transform-origin: top;
top: 0;
left: 0;
transform: scaleY(0);
}
&:after {
content: "";
position: absolute;
height: 5vmin;
width: 25%;
right: 100%;
background: radial-gradient(
circle at center,
var(--r) 1vmin,
rgba(255, 255, 255, 0.001) 1vmin
),
linear-gradient(to right, var(--r), var(--w));
background-size: 2vmin 2vmin, 100% 2px;
background-repeat: no-repeat;
background-position: 0px 50%, 50% 50%;
top: calc(50% - 2.5vmin);
transform-origin: right;
}
}
&:nth-of-type(even) {
flex-direction: row-reverse;
--x: -10vmin;
p {
&:after {
right: auto;
left: 100%;
transform-origin: left;
}
}
}
@for $i from 1 through 3 {
&:nth-of-type(#{$i}) {
img {
transition: 0.5s var(--expo) #{$i/10 + 1.5}s, opacity 2s ease-in-out 0s;
}
p {
transition: transform 0.5s var(--expo) #{$i/10 + 1}s;
}
p:before,
p:after {
transition: transform 0.5s var(--expo) #{$i/10 + 1.5}s,
background-size 0.75s var(--expo) #{$i/10 + 2}s;
}
}
}
}
}
section,
nav {
transition: transform 0.75s var(--expo) 0s;
}
nav {
width: 100vw;
height: 100vh;
position: fixed;
top: 0;
left: 0;
z-index: 9;
background: var(--bl);
color: var(--w);
padding: 0;
transform: translateX(100vw) rotateY(65deg) skewY(60deg) scaleY(7)
translateZ(0px);
transform-origin: 50% left;
overflow: hidden;
ul {
list-style-type: none;
padding: 0;
transform: translateZ(0px);
position: relative;
overflow: hidden;
}
> ul {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(8, 1fr);
grid-column-gap: 0px;
grid-row-gap: 0px;
height: 100vh;
margin: 0;
transform: translateZ(0px);
transition: 0.5s var(--expo);
box-shadow: inset 0 0 0 calc(-1vmin - 1px) var(--bl),
inset 0 0 0 calc(-1vmin + 1px) var(--w);
li {
padding: 1vmin;
transform: translateY(75vh) translateZ(0px);
backface-visibility: hidden;
will-change: transform;
transition: 1s var(--expo);
overflow: hidden;
}
> li {
box-sizing: border-box;
transform: translateY(100vh) translateZ(0px);
&:first-of-type {
grid-area: 1 / 1 / 2 / 4;
font-size: 3.5vmin;
position: relative;
&:after {
content: "";
position: absolute;
width: calc(100% - 4vmin);
height: 1px;
bottom: 0;
left: 2vmin;
background: var(--r);
transition: transform 0.5s var(--expo);
transform: scaleX(0);
}
ul {
display: flex;
justify-content: space-between;
position: relative;
overflow: hidden;
padding-bottom: 0;
> li {
color: var(--w);
transform: translateY(100vh);
cursor: pointer;
text-align: center;
flex-grow: 1;
overflow: visible;
margin-top: -1vmin;
&:hover {
color: var(--r);
&:after {
transform: translateY(0);
}
}
&:before {
content: "";
position: absolute;
width: 1px;
height: 50%;
right: 0;
top: calc(50% - 1vmin);
background: var(--r);
transform-origin: bottom;
transform: scaleY(0);
}
&:after {
content: "📍";
position: absolute;
left: 1rem;
filter: saturate(0) brightness(2);
transition: 0.3s ease-in-out;
transform: translateY(250%);
display: inline-block;
}
&:last-of-type {
&:before {
display: none;
}
}
}
}
}
&:nth-of-type(2) {
grid-area: 2 / 1 / 8 / 4;
display: flex;
flex-wrap: nowrap;
flex-direction: column;
align-items: stretch;
max-width: 100%;
font-family: "Bogart";
color: var(--y);
font-size: 5vmin;
> ul {
> li {
position: relative;
overflow: hidden;
margin-right: 1.5vmin;
&:nth-of-type(even) {
margin-right: 0;
margin-left: 1.5vmin;
}
}
}
ul {
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-template-rows: repeat(2, 1fr);
width: 100%;
font-family: "Bogart";
flex-grow: 2;
color: var(--r);
> li {
font-family: "Bogart";
font-size: 3vmin;
padding-left: 0;
position: relative;
&:before {
content: "";
position: absolute;
width: calc(100% - 12.5vmin);
right: 0;
height: 1px;
background: var(--w);
top: 3.25vmin;
transition: transform 0.5s var(--expo) 0s;
transform-origin: left;
transform: scaleX(0);
}
&:nth-of-type(2) {
> ul li {
&:after {
content: "🍟";
}
}
}
&:nth-of-type(3) {
> ul li {
&:after {
content: "🥬";
}
}
}
&:nth-of-type(4) {
> ul li {
&:after {
content: "🥤";
}
}
}
> ul {
li {
font-size: 2vmin;
color: var(--w);
font-family: "Oswald";
cursor: pointer;
text-align: right;
&:after {
content: "🍔";
margin-left: 0vmin;
display: inline-block;
filter: saturate(0);
transition: 0.3s ease-in-out;
transform: translateY(-250%) scale(1.25);
}
&:hover {
color: var(--r);
&:after {
margin-left: 2.5vmin;
transform: translateY(0) scale(1.5);
}
& + li + li {
&:after {
transform: translateY(250%) scale(1.25);
}
}
}
&:before {
display: none;
}
}
}
}
}
& ~ li {
display: flex;
justify-content: center;
align-items: center;
color: var(--bl);
transform-style: preserve-3d;
transform: translateY(100vh) translateZ(0px);
cursor: pointer;
box-shadow: inset 0 0 0 2px var(--bl);
background: linear-gradient(to bottom, var(--r) 50%, var(--y) 50%);
background-size: 100% 200%;
background-position: 50% 0px;
&:hover {
background-position: 50% 100%;
}
&:nth-of-type(even) {
background: linear-gradient(to top, var(--r) 50%, var(--y) 50%);
background-size: 100% 200%;
background-position: 50% 100%;
&:hover {
background-position: 50% 0px;
}
}
}
}
}
}
> ul > li {
font-family: "Bogart";
font-size: 2.5vmin;
position: relative;
color: var(--y);
ul {
font-family: "Oswald";
font-size: 2vmin;
}
}
}
}
/*** nada nada limonada ***/
Also see: Tab Triggers