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.
<div class="logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 751.45 95.26">
<g id="Layer_2" data-name="Layer 2">
<g id="Layer_1-2" data-name="Layer 1">
<path
d="M74.47,68.66c0,15.45-14.18,26.56-37.24,26.56C23.78,95.22,7.77,89.77,0,80.65l1.77-29.6H3.92C8.12,75.4,21.34,91.21,38.56,91.21c13.12,0,24.23-8.25,24.32-18.64.08-9.13-13.31-14.93-25-19.24L30,50.54C17.58,46,1,39.4,1,24.32,1,10.39,15.37,0,37.28,0c12.92,0,21.57,1.52,30,5l2,26-1,.05C62.26,13.47,48.84,3.19,35.76,3.19c-14.66,0-23.23,6.18-23.23,15.05,0,10.89,12,15.71,24.59,20.4L45,41.55C59.18,46.87,74.47,53,74.47,68.66Z"
/>
<path
d="M159.37,28.53l-1,0C150,7.13,146.51,3.8,129.9,3.8h-4.62V72.66c0,11.35,1,18.15,3.85,20.15v.93H108.51v-.93c2.82-2,3.85-8.8,3.85-20.15v-68h-4.63C92.29,4.65,87.8,8,79.36,28.53H78.27l3.81-27h75.35Z"
/>
<path
d="M238.68,93.9H219.57s0-1,0-1.32c0-18.19-11.25-40.1-11.25-40.1-13.73-.65-32.81,4.23-43.25,16.4-.81,2.23-1.5,4.19-2,5.78-1,2.91-3.74,11.53-3,19.24H149.83L185.1,4a11.54,11.54,0,0,0-4.83-.83V1.52h20.46ZM206.25,47.22,190.14,5.58h-.93c-3.77,9.64-13.26,33.93-20.09,52.21l.44.76A159.36,159.36,0,0,1,206.25,47.22Z"
/>
<path
d="M295.77,51.91c9.62,6.9,29.14,41.85,29.14,41.85H303.39c-.05-13.56-4-23.89-13.44-39-.69-1.11-1.54-1.56-9.16-1.56H262V72.66c0,11.35,1,18.15,3.85,20.15v.93H245.2v-.93c2.66-1.89,3.72-8,3.84-18.26V6.39c0-2.42-2.75-3.06-4.77-3.21h-1.41V1.52h39.19c24.33,0,37.37,7.6,37.37,23.31,0,13.05-11.7,23.19-23.62,26.23C295.8,51.06,295.6,51.79,295.77,51.91Zm10.61-26.19c0-13.43-8.11-21.07-24.83-21.07H262V49.28c2.91.5,19.46.76,22,.76C297.76,50,306.38,38.89,306.38,25.72Z"
/>
<path
d="M417.68,50c0,26.57-11.58,45.26-40.13,45.26-29.51,0-47.46-17.36-47.46-47C330.09,18.88,351,0,378.61,0c14.82,0,23.91,2.83,32.79,7.79l1.41,25.73-1.44,0c-8.28-21.92-19.93-30.38-33.9-30.38-20.27,0-33.19,16.7-33.19,44.19,0,26.85,12.89,44.79,34.42,44.79C395.09,92.17,406,75.6,406,56.39c0-3-1.8-4.22-4.42-4.22-4.53,0-15.08,3.72-21.29,8.79l-.68,0-5.71-11.2V49h42.88S417.68,49.75,417.68,50Z"
/>
<path
d="M507.76,93.9H488.65s0-1,0-1.32c0-18.19-11.24-40.1-11.24-40.1-13.74-.65-32.82,4.23-43.26,16.4-.81,2.23-1.5,4.19-2,5.78-1,2.91-3.74,11.53-3,19.24H418.91L454.18,4a11.52,11.52,0,0,0-4.82-.83V1.52h20.45ZM475.33,47.22,459.22,5.58h-.93C454.52,15.22,445,39.51,438.2,57.79l.44.76A159.36,159.36,0,0,1,475.33,47.22Z"
/>
<path
d="M585.63,59l-5.57,34.72H511V92.43L566.21,4.75h-8.47c-22.24,0-34,5.87-43.79,29.53h-1.21l6.61-32.76h63.79V2.7L528.52,90.45h10.79c27.21,0,34.6-10.42,44.83-31.42Z"
/>
<path
d="M662.66,61.86,658.5,93.74H594.64v-.93c2.83-2,3.86-8.8,3.86-20.15V6.38c0-2.41-2.75-3-4.77-3.2h-1.41V1.52h64.14l4.7,29h-1.41C652.47,9.92,646.33,4.65,627.07,4.65H611.42v39.5h14.51c13.68,0,22.68-.89,26.6-2.54h.26v8.71h-.26c-3.92-1.65-12.92-3-26.6-3H611.42V90.61h16.91c19.87-.81,25.52-5.89,32.71-28.73Z"
/>
<path
d="M722.32,51.91c9.62,6.9,29.13,41.85,29.13,41.85H729.94c-.05-13.56-4-23.89-13.44-39-.69-1.11-1.55-1.56-9.16-1.56H688.5V72.76l0-.1c0,11.35,1,18.15,3.85,20.15v.93H671.74v-.93c2.66-1.89,3.73-8,3.84-18.26V6.39c0-2.42-2.74-3.06-4.77-3.21h-1.4V1.52H708.6c24.32,0,37.37,7.6,37.37,23.31,0,13.05-11.7,23.19-23.62,26.23C722.35,51.06,722.15,51.79,722.32,51.91Zm10.61-26.19c0-13.43-8.11-21.07-24.83-21.07H688.51V49.28c2.91.5,19.46.76,22,.76C724.31,50,732.92,38.89,732.93,25.72Z"
/>
</g>
</g>
</svg>
</div>
<div class="menu-button">
<span></span>
<span></span>
<span></span>
</div>
<div class="menu-overlay">
<div class="nav">
<div class="logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 751.45 95.26">
<g id="Layer_2" data-name="Layer 2" style="fill: white">
<g id="Layer_1-2" data-name="Layer 1">
<path
d="M74.47,68.66c0,15.45-14.18,26.56-37.24,26.56C23.78,95.22,7.77,89.77,0,80.65l1.77-29.6H3.92C8.12,75.4,21.34,91.21,38.56,91.21c13.12,0,24.23-8.25,24.32-18.64.08-9.13-13.31-14.93-25-19.24L30,50.54C17.58,46,1,39.4,1,24.32,1,10.39,15.37,0,37.28,0c12.92,0,21.57,1.52,30,5l2,26-1,.05C62.26,13.47,48.84,3.19,35.76,3.19c-14.66,0-23.23,6.18-23.23,15.05,0,10.89,12,15.71,24.59,20.4L45,41.55C59.18,46.87,74.47,53,74.47,68.66Z"
/>
<path
d="M159.37,28.53l-1,0C150,7.13,146.51,3.8,129.9,3.8h-4.62V72.66c0,11.35,1,18.15,3.85,20.15v.93H108.51v-.93c2.82-2,3.85-8.8,3.85-20.15v-68h-4.63C92.29,4.65,87.8,8,79.36,28.53H78.27l3.81-27h75.35Z"
/>
<path
d="M238.68,93.9H219.57s0-1,0-1.32c0-18.19-11.25-40.1-11.25-40.1-13.73-.65-32.81,4.23-43.25,16.4-.81,2.23-1.5,4.19-2,5.78-1,2.91-3.74,11.53-3,19.24H149.83L185.1,4a11.54,11.54,0,0,0-4.83-.83V1.52h20.46ZM206.25,47.22,190.14,5.58h-.93c-3.77,9.64-13.26,33.93-20.09,52.21l.44.76A159.36,159.36,0,0,1,206.25,47.22Z"
/>
<path
d="M295.77,51.91c9.62,6.9,29.14,41.85,29.14,41.85H303.39c-.05-13.56-4-23.89-13.44-39-.69-1.11-1.54-1.56-9.16-1.56H262V72.66c0,11.35,1,18.15,3.85,20.15v.93H245.2v-.93c2.66-1.89,3.72-8,3.84-18.26V6.39c0-2.42-2.75-3.06-4.77-3.21h-1.41V1.52h39.19c24.33,0,37.37,7.6,37.37,23.31,0,13.05-11.7,23.19-23.62,26.23C295.8,51.06,295.6,51.79,295.77,51.91Zm10.61-26.19c0-13.43-8.11-21.07-24.83-21.07H262V49.28c2.91.5,19.46.76,22,.76C297.76,50,306.38,38.89,306.38,25.72Z"
/>
<path
d="M417.68,50c0,26.57-11.58,45.26-40.13,45.26-29.51,0-47.46-17.36-47.46-47C330.09,18.88,351,0,378.61,0c14.82,0,23.91,2.83,32.79,7.79l1.41,25.73-1.44,0c-8.28-21.92-19.93-30.38-33.9-30.38-20.27,0-33.19,16.7-33.19,44.19,0,26.85,12.89,44.79,34.42,44.79C395.09,92.17,406,75.6,406,56.39c0-3-1.8-4.22-4.42-4.22-4.53,0-15.08,3.72-21.29,8.79l-.68,0-5.71-11.2V49h42.88S417.68,49.75,417.68,50Z"
/>
<path
d="M507.76,93.9H488.65s0-1,0-1.32c0-18.19-11.24-40.1-11.24-40.1-13.74-.65-32.82,4.23-43.26,16.4-.81,2.23-1.5,4.19-2,5.78-1,2.91-3.74,11.53-3,19.24H418.91L454.18,4a11.52,11.52,0,0,0-4.82-.83V1.52h20.45ZM475.33,47.22,459.22,5.58h-.93C454.52,15.22,445,39.51,438.2,57.79l.44.76A159.36,159.36,0,0,1,475.33,47.22Z"
/>
<path
d="M585.63,59l-5.57,34.72H511V92.43L566.21,4.75h-8.47c-22.24,0-34,5.87-43.79,29.53h-1.21l6.61-32.76h63.79V2.7L528.52,90.45h10.79c27.21,0,34.6-10.42,44.83-31.42Z"
/>
<path
d="M662.66,61.86,658.5,93.74H594.64v-.93c2.83-2,3.86-8.8,3.86-20.15V6.38c0-2.41-2.75-3-4.77-3.2h-1.41V1.52h64.14l4.7,29h-1.41C652.47,9.92,646.33,4.65,627.07,4.65H611.42v39.5h14.51c13.68,0,22.68-.89,26.6-2.54h.26v8.71h-.26c-3.92-1.65-12.92-3-26.6-3H611.42V90.61h16.91c19.87-.81,25.52-5.89,32.71-28.73Z"
/>
<path
d="M722.32,51.91c9.62,6.9,29.13,41.85,29.13,41.85H729.94c-.05-13.56-4-23.89-13.44-39-.69-1.11-1.55-1.56-9.16-1.56H688.5V72.76l0-.1c0,11.35,1,18.15,3.85,20.15v.93H671.74v-.93c2.66-1.89,3.73-8,3.84-18.26V6.39c0-2.42-2.74-3.06-4.77-3.21h-1.4V1.52H708.6c24.32,0,37.37,7.6,37.37,23.31,0,13.05-11.7,23.19-23.62,26.23C722.35,51.06,722.15,51.79,722.32,51.91Zm10.61-26.19c0-13.43-8.11-21.07-24.83-21.07H688.51V49.28c2.91.5,19.46.76,22,.76C724.31,50,732.92,38.89,732.93,25.72Z"
/>
</g>
</g>
</svg>
</div>
<nav class="nav__items">
<p class="nav__category">Rainbow lorem ipsum</p>
<a class="nav__item" href="#">Nine Years</a>
<a class="nav__item" href="#">Worth Of Breakin'</a>
<a class="nav__item" href="#">My Back</a>
</nav>
<nav class="nav__items">
<p class="nav__category">Stargazer lorem ipsum</p>
<a class="nav__item" href="#">There's No Sun</a>
<a class="nav__item" href="#">In The Shadow Of The Wizard</a>
<a class="nav__item" href="#">See How He Glides</a>
</nav>
</div>
<div class="menu-overlay__image">
<img
src="https://images.unsplash.com/photo-1627952073979-e40605fd8b17?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1875&q=80"
alt=""
/>
</div>
</div>
<main>
<p class="intro">
High noon, oh I'd sell my soul for water Nine years worth of breakin' my
back There's no sun in the shadow of the wizard See how he glides, why
he's lighter than air Oh I see his face!
</p>
<p class="copy">
Where is your star? Is it far, is it far, is it far? When do we leave? I
believe, yes, I believe In the heat and the rain With whips and chains
To see him fly So many die We build a tower of stone With our flesh and
bone Just to see him fly But don't know why Now where do we go? Hot
wind, moving fast across the desert We feel that our time has arrived
The world spins, while we put his dream together A tower of stone to
take him straight to the sky Oh I see his face! Where is your star? Is
it far, is it far, is it far? When do we leave? Hey, I believe, I
believe In the heat and the rain With whips and chains Just to see him
fly Too many die We build a tower of stone With our flesh and bone To
see him fly But we don't know why Ooh, now where do we go All eyes see
the figure of the wizard As he climbs to the top of the world No sound,
as he falls instead of rising Time standing still, then there's blood on
the sand Oh I see his face! Where was your star? Was it far, was it far
When did we leave? We believed, we believed, we believed In heat and
rain With the whips and chains To see him fly So many died We built a
tower of stone With our flesh and bone To see him fly But why In all the
rain With all the chains Did so many die Just to see him fly Look at my
flesh and bone Now, look, look, look, look, Look at his tower of stone I
see a rainbow rising Look there, on the horizon And I'm coming home, I'm
coming home, I'm coming home Time is standing still He gave back my will
Ooh ooh ooh ooh Going home I'm going home My eyes are bleeding And my
heart is leaving here But it's not home But it's not home Ooh Take me
back He gave me back my will Ooh ooh ooh ooh Going home I'm going home
My eyes are bleeding And my heart is leaving here But it's not home But
it's not home Ooh Take me back, take me back Back to my home ooh, ooh,
ooh
</p>
</main>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
font-size: 16px;
}
html {
font-size: 100%;
font-family: sans-serif;
}
$menu-button-bar-height: 0.25rem;
$menu-button-width: $menu-button-bar-height * 6;
$menu-button-bar-width: $menu-button-width;
.menu-button {
width: $menu-button-width;
position: fixed;
top: 2rem;
right: 2rem;
cursor: pointer;
height: calc(#{$menu-button-bar-height} * 5);
z-index: 666;
span {
width: $menu-button-bar-width;
height: $menu-button-bar-height;
background-color: black;
display: block;
position: absolute;
transition: all 0.6s ease;
&:nth-of-type(2) {
top: calc(#{$menu-button-bar-height} * 2);
}
&:nth-of-type(3) {
top: calc(#{$menu-button-bar-height} * 4);
}
}
&.active {
span {
background-color: white;
}
span:nth-of-type(1) {
transform: translateY($menu-button-bar-height * 2) rotate(-45deg);
}
span:nth-of-type(2) {
transform: translateX($menu-button-bar-width);
opacity: 0;
}
span:nth-of-type(3) {
transform: translateY(-$menu-button-bar-height * 2) rotate(45deg);
}
}
}
.menu-overlay {
width: 100%;
height: 100%;
position: fixed;
top: 0;
background-color: black;
display: grid;
grid-template-columns: 3fr 4fr;
color: white;
transform: translateX(100%);
transition: all 0.6s ease-in-out;
&.open {
transform: translateX(0);
}
&.open &__image {
img {
animation: fadeIn 0.8s ease-in-out 0.6s forwards;
}
}
&.open .nav {
animation: fadeIn 0.8s ease-in-out 0.2s forwards;
}
&__image {
img {
width: 100%;
height: 100%;
object-fit: cover;
opacity: 0;
}
}
}
.nav {
padding: 2rem;
opacity: 0;
&__items {
display: flex;
flex-direction: column;
&:not(:first-child) {
margin-top: 4rem;
}
}
&__category {
text-transform: uppercase;
font-size: 0.75rem;
letter-spacing: 0.125em;
opacity: 0.5;
}
&__item {
color: white;
margin-top: 1rem;
text-decoration: none;
position: relative;
transition: all 0.2s ease-in-out;
&::before {
content: "";
height: 1px;
width: 0;
background-color: white;
position: absolute;
top: 50%;
left: 0;
transform: translateY(-50%);
transition: all 0.2s ease-in-out;
}
&:hover {
padding-left: calc(2rem + 1rem);
&::before {
width: 2rem;
}
}
}
}
.logo {
position: fixed;
width: 176px;
top: 2rem;
left: 2rem;
transition: all 0.6s ease-in-out;
&.scrolled {
transform-origin: top right;
left: -8rem;
top: 2rem;
transform: rotate(-90deg);
}
}
.intro {
font-size: 1.5rem;
font-style: italic;
line-height: 1.45;
max-width: 550px;
margin: 8rem auto 4rem auto;
}
.copy {
max-width: 550px;
margin: 0 auto;
line-height: 1.75;
padding-bottom: 4rem;
}
@keyframes fadeIn {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.work-link {
position: absolute;
bottom: 1rem;
right: 1rem;
text-transform: uppercase;
letter-spacing: 0.1em;
font-size: 0.5rem;
text-decoration: none;
color: black;
z-index: 7777;
}
const menuButton = document.querySelector(".menu-button");
const menuOverlay = document.querySelector(".menu-overlay");
menuButton.addEventListener("click", function () {
menuButton.classList.toggle("active");
menuOverlay.classList.toggle("open");
});
window.onscroll = function () {
transformLogo();
};
const logo = document.querySelector(".logo");
function transformLogo() {
if (document.body.scrollTop > 80 || document.documentElement.scrollTop > 80) {
logo.classList.add("scrolled");
} else {
logo.classList.remove("scrolled");
}
}
Also see: Tab Triggers