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="page-wrap">
<header class="page-header">
<h1>
<div class="header-layer">See the World</div>
<div class="header-layer" aria-hidden="true">See the World</div>
<div class="header-layer" aria-hidden="true">See the World</div>
<div class="header-layer" aria-hidden="true">See the World</div>
<div class="header-layer" aria-hidden="true">See the World</div>
<div class="header-layer" aria-hidden="true">See the World</div>
<div class="header-layer" aria-hidden="true">See the World</div>
<div class="header-layer" aria-hidden="true">See the World</div>
<div class="header-layer" aria-hidden="true">See the World</div>
<div class="header-layer" aria-hidden="true">See the World</div>
<div class="header-layer" aria-hidden="true">See the World</div>
<div class="header-layer" aria-hidden="true">See the World</div>
<div class="header-layer" aria-hidden="true">See the World</div>
<div class="header-layer" aria-hidden="true">See the World</div>
<div class="header-layer" aria-hidden="true">See the World</div>
<div class="header-layer" aria-hidden="true">See the World</div>
<div class="header-layer" aria-hidden="true">See the World</div>
<div class="header-layer" aria-hidden="true">See the World</div>
<div class="header-layer" aria-hidden="true">See the World</div>
<div class="header-layer" aria-hidden="true">See the World</div>
<div class="header-layer" aria-hidden="true">See the World</div>
</h1>
<img src="https://assets.codepen.io/t-1/juli-kosolapova-pZ-XFIrJMtE-unsplash.jpg" alt="A desert scene. Deep orange sand and a cloudy sky, with craggy hills and mountains looming in the distance. ">
<!-- Photo by Juli Kosolapova for Unsplash. https://unsplash.com/photos/pZ-XFIrJMtE -->
</header>
<main class="page-main">
<article>
<h2>
<div class="header-layer">The journey of a thousand miles starts with a single step</div>
<div class="header-layer" aria-hidden="true">The journey of a thousand miles starts with a single step</div>
<div class="header-layer" aria-hidden="true">The journey of a thousand miles starts with a single step</div>
<div class="header-layer" aria-hidden="true">The journey of a thousand miles starts with a single step</div>
<div class="header-layer" aria-hidden="true">The journey of a thousand miles starts with a single step</div>
<div class="header-layer" aria-hidden="true">The journey of a thousand miles starts with a single step</div>
<div class="header-layer" aria-hidden="true">The journey of a thousand miles starts with a single step</div>
<div class="header-layer" aria-hidden="true">The journey of a thousand miles starts with a single step</div>
<div class="header-layer" aria-hidden="true">The journey of a thousand miles starts with a single step</div>
<div class="header-layer" aria-hidden="true">The journey of a thousand miles starts with a single step</div>
<div class="header-layer" aria-hidden="true">The journey of a thousand miles starts with a single step</div>
<div class="header-layer" aria-hidden="true">The journey of a thousand miles starts with a single step</div>
<div class="header-layer" aria-hidden="true">The journey of a thousand miles starts with a single step</div>
<div class="header-layer" aria-hidden="true">The journey of a thousand miles starts with a single step</div>
<div class="header-layer" aria-hidden="true">The journey of a thousand miles starts with a single step</div>
<div class="header-layer" aria-hidden="true">The journey of a thousand miles starts with a single step</div>
<div class="header-layer" aria-hidden="true">The journey of a thousand miles starts with a single step</div>
<div class="header-layer" aria-hidden="true">The journey of a thousand miles starts with a single step</div>
<div class="header-layer" aria-hidden="true">The journey of a thousand miles starts with a single step</div>
<div class="header-layer" aria-hidden="true">The journey of a thousand miles starts with a single step</div>
<div class="header-layer" aria-hidden="true">The journey of a thousand miles starts with a single step</div>
</h2>
<p><br>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Dignissimos laborum cumque incidunt, enim ipsa dicta? Porro illo doloribus, consectetur eum exercitationem sit ipsam, est nesciunt maxime, eius animi dolor? Harum.</p>
<img src="https://assets.codepen.io/t-1/saad-chaudhry-WdBu6PJ83uY-unsplash.jpg" alt="A distant view of a vast forest of evergreen trees covered with snow. A pink fog hovers close to the tops of the trees. ">
<!-- Photo by Saad Chaudhry for Unsplash. https://unsplash.com/photos/WdBu6PJ83uY -->
<h2>
<div class="header-layer">Expand Your Horizons</div>
<div class="header-layer" aria-hidden="true">Expand Your Horizons</div>
<div class="header-layer" aria-hidden="true">Expand Your Horizons</div>
<div class="header-layer" aria-hidden="true">Expand Your Horizons</div>
<div class="header-layer" aria-hidden="true">Expand Your Horizons</div>
<div class="header-layer" aria-hidden="true">Expand Your Horizons</div>
<div class="header-layer" aria-hidden="true">Expand Your Horizons</div>
<div class="header-layer" aria-hidden="true">Expand Your Horizons</div>
<div class="header-layer" aria-hidden="true">Expand Your Horizons</div>
<div class="header-layer" aria-hidden="true">Expand Your Horizons</div>
<div class="header-layer" aria-hidden="true">Expand Your Horizons</div>
<div class="header-layer" aria-hidden="true">Expand Your Horizons</div>
<div class="header-layer" aria-hidden="true">Expand Your Horizons</div>
<div class="header-layer" aria-hidden="true">Expand Your Horizons</div>
<div class="header-layer" aria-hidden="true">Expand Your Horizons</div>
<div class="header-layer" aria-hidden="true">Expand Your Horizons</div>
<div class="header-layer" aria-hidden="true">Expand Your Horizons</div>
<div class="header-layer" aria-hidden="true">Expand Your Horizons</div>
<div class="header-layer" aria-hidden="true">Expand Your Horizons</div>
<div class="header-layer" aria-hidden="true">Expand Your Horizons</div>
<div class="header-layer" aria-hidden="true">Expand Your Horizons</div>
</h2>
<img src="https://assets.codepen.io/t-1/claudel-rheault-ZVbv1akA-l4-unsplash.jpg" alt="A grassy field in a valley between green, grassy hills, beneath a sunlit sky filled with puffy clouds. ">
<!-- image by Claudel Rheault for Unsplash. Full size at: https://unsplash.com/photos/ZVbv1akA-l4 -->
<p>Sunt excepturi in nostrum, fugiat veritatis ab sit sequi nemo aperiam deserunt temporibus, dolorem ex adipisci autem. Quasi, iure fugiat! Nulla amet doloribus velit nam tempora, soluta consequatur doloremque omnis?</p>
<h2>
<div class="header-layer">Explore and Reflect</div>
<div class="header-layer" aria-hidden="true">Explore and Reflect</div>
<div class="header-layer" aria-hidden="true">Explore and Reflect</div>
<div class="header-layer" aria-hidden="true">Explore and Reflect</div>
<div class="header-layer" aria-hidden="true">Explore and Reflect</div>
<div class="header-layer" aria-hidden="true">Explore and Reflect</div>
<div class="header-layer" aria-hidden="true">Explore and Reflect</div>
<div class="header-layer" aria-hidden="true">Explore and Reflect</div>
<div class="header-layer" aria-hidden="true">Explore and Reflect</div>
<div class="header-layer" aria-hidden="true">Explore and Reflect</div>
<div class="header-layer" aria-hidden="true">Explore and Reflect</div>
<div class="header-layer" aria-hidden="true">Explore and Reflect</div>
<div class="header-layer" aria-hidden="true">Explore and Reflect</div>
<div class="header-layer" aria-hidden="true">Explore and Reflect</div>
<div class="header-layer" aria-hidden="true">Explore and Reflect</div>
<div class="header-layer" aria-hidden="true">Explore and Reflect</div>
<div class="header-layer" aria-hidden="true">Explore and Reflect</div>
<div class="header-layer" aria-hidden="true">Explore and Reflect</div>
<div class="header-layer" aria-hidden="true">Explore and Reflect</div>
<div class="header-layer" aria-hidden="true">Explore and Reflect</div>
<div class="header-layer" aria-hidden="true">Explore and Reflect</div>
</h2>
<p> Aenean iaculis odio et eleifend elementum. Pellentesque porta lacus sit amet ligula tristique ornare. Ut euismod suscipit enim. Morbi eu molestie odio. Nullam pellentesque bibendum magna non aliquet. Praesent commodo metus ut dapibus sollicitudin. Etiam tristique arcu et risus venenatis egestas. Mauris quis feugiat leo. Mauris scelerisque eleifend risus a suscipit. Praesent commodo pharetra vehicula. Praesent imperdiet luctus ex eget consectetur. Sed facilisis lobortis dolor quis scelerisque. Pellentesque porta orci nec viverra semper.</p>
<img src="https://assets.codepen.io/t-1/simon-berger-9Ct73yKbpEo-unsplash.jpg" alt="A waterfall, bathed in sunlight, pours down into a green river in a tropical forest. ">
<!-- Photo by Simon Berger for Unsplash. https://unsplash.com/photos/9Ct73yKbpEo -->
<p>In nec ornare mauris. Ut bibendum libero sit amet leo finibus ornare. Donec vel ultrices velit, vel congue elit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Etiam blandit sem nisi, eget fringilla risus tristique sit amet. Ut quis dictum massa, nec tincidunt urna. Aliquam dignissim mi at eros egestas elementum. Phasellus tempor lectus id consectetur finibus. Etiam felis augue, ullamcorper sed pretium dictum, interdum sed nulla. Morbi eu ante ac tortor suscipit posuere. Praesent feugiat, dolor sed condimentum tincidunt, massa tortor congue lorem, eget sollicitudin nulla nibh sit amet justo. Pellentesque erat quam, iaculis pellentesque eros non, accumsan laoreet quam.</p>
<img src="https://assets.codepen.io/t-1/robert-bye-OlZ1nWLEEgM-unsplash.jpg" alt="A distant view of a cliffside beach. The water is deep blue and very calm.">
<!-- photo by Robert Bye for Unsplash. https://unsplash.com/photos/OlZ1nWLEEgM -->
<p>Praesent nec lacus urna. Pellentesque hendrerit turpis sed dictum vehicula. Ut in sapien odio. Sed vitae finibus nisl. Pellentesque dui nisl, condimentum facilisis feugiat nec, dictum quis nisi. Donec pellentesque ornare mauris non congue. Integer consequat nulla at odio congue luctus.</p>
<h2>
<div class="header-layer">Change Your Perspective</div>
<div class="header-layer" aria-hidden="true">Change Your Perspective</div>
<div class="header-layer" aria-hidden="true">Change Your Perspective</div>
<div class="header-layer" aria-hidden="true">Change Your Perspective</div>
<div class="header-layer" aria-hidden="true">Change Your Perspective</div>
<div class="header-layer" aria-hidden="true">Change Your Perspective</div>
<div class="header-layer" aria-hidden="true">Change Your Perspective</div>
<div class="header-layer" aria-hidden="true">Change Your Perspective</div>
<div class="header-layer" aria-hidden="true">Change Your Perspective</div>
<div class="header-layer" aria-hidden="true">Change Your Perspective</div>
<div class="header-layer" aria-hidden="true">Change Your Perspective</div>
<div class="header-layer" aria-hidden="true">Change Your Perspective</div>
<div class="header-layer" aria-hidden="true">Change Your Perspective</div>
<div class="header-layer" aria-hidden="true">Change Your Perspective</div>
<div class="header-layer" aria-hidden="true">Change Your Perspective</div>
<div class="header-layer" aria-hidden="true">Change Your Perspective</div>
<div class="header-layer" aria-hidden="true">Change Your Perspective</div>
<div class="header-layer" aria-hidden="true">Change Your Perspective</div>
<div class="header-layer" aria-hidden="true">Change Your Perspective</div>
<div class="header-layer" aria-hidden="true">Change Your Perspective</div>
<div class="header-layer" aria-hidden="true">Change Your Perspective</div>
</h2>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Quisque lobortis mattis turpis eu commodo. Donec diam massa, convallis at ex non, finibus lacinia ipsum. Vestibulum rutrum nunc mollis condimentum mollis. Nunc at nunc mauris. Proin magna nisl, imperdiet imperdiet malesuada a, gravida ac dolor. Vivamus ex ipsum, convallis vitae egestas in, dignissim eu augue. Nullam euismod orci lectus, ut tempor mauris malesuada sit amet.</p>
<p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Dignissimos laborum cumque incidunt, enim ipsa dicta? Porro illo doloribus, consectetur eum exercitationem sit ipsam, est nesciunt maxime, eius animi dolor? Harum.</p>
<p>Illo numquam, sapiente neque repellendus facere amet doloribus asperiores quia eum? Sunt vero amet neque vel? Tempora, nulla voluptatum amet autem culpa magnam debitis! Dolores esse quam amet nobis ut.</p>
</article>
</main>
<footer class="page-footer">
3D Floating Headers<br><br>
Made with 🤍 and 😜 by
<a href="https://amitsh.com">Amit Sheen</a>
for the
<a href="https://codepen.io/tag/cpc-huge-headers/">
Huge Headers CodePenChallenge
</a>
</footer>
</div>
@import url("https://fonts.googleapis.com/css?family=Lora:400,400i,700");
*,
*::before,
*::after {
padding: 0;
margin: 0 auto;
box-sizing: border-box;
}
body {
font-family: Lora, sans-serif;
background-color: #555;
color: #fff;
}
.page-wrap {
width: 100%;
height: 100vh;
padding: 4em 1em;
perspective: 1000px;
overflow-x: hidden;
overflow-y: scroll;
img {
width: 100%;
height: 300px;
object-fit: cover;
object-position: center;
margin-block: 1em;
box-shadow: 0 3px 6px #0004;
border: 1px solid;
}
*:not(:empty) {
transform-style: preserve-3d;
}
}
.page-header {
max-width: 650px;
h1 {
height: 100vh;
display: grid;
place-items: center;
font-size: min(28vw, 191px);
line-height: 0.9;
--rx: 15deg;
--ry: 15deg;
@media (max-width: 682px) {
transform: translateX(-0.15em);
}
}
}
.page-main {
max-width: 650px;
h2 {
font-size: min(8vw, 62px);
height: 5em;
}
}
.header-layer {
position: absolute;
left: 50%;
top: 50%;
width: 100%;
text-align: center;
color: hsl(0, 0%, var(--light, 0%));
transform: translate(-50%, -50%) rotateX(var(--rx, 0)) rotateY(var(--ry, 0))
translateZ(var(--tz, 0));
&:nth-child(1) {
filter: blur(6px);
color: #0006;
}
@for $i from 0 to 20 {
&:nth-child(#{$i + 2}) {
--tz: #{$i * 1 + 100}px;
--light: #{($i + 1) * 5}%;
}
}
}
footer {
max-width: 650px;
text-align: center;
margin-top: 3em;
border-top: 1px solid #fff3;
padding-block: 3em;
a {
color: aquamarine;
text-decoration: none;
&:hover {
color: aqua;
}
}
}
Also see: Tab Triggers