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="container">
<div class="hero">
<div class="hero__image">
<div class="hero__image--overlay"></div>
<div class="hero__child hero__child--primary animation--floating"></div>
<div class="hero__child hero__child--secondary animation--floating"></div>
<p class="hero__title animation--title-in">The flaming mountain</p>
<p class="hero__subtitle animation--title-in">by John Blaine</p>
</div>
</div>
</div>
<div class="section">
<h2>A RICK BRANT SCIENCE-ADVENTURE STORY</h2>
<hr>
<p class="section__text">Rock, melting like butter on a hot stove! It is hard to believe, but that is what happens on San Luz, a small island off the coast of South America. When Rick Brant and his pal Dan Scott fly to the famous resort island to join Rick's father, head of the Spindrift Scientific Foundation, a seemingly inactive volcano is about to explode in an eruption which could easily blow San Luz off the map.</p>
<p>The immediate threat is to a small town at the foot of the volcano, where the air reeks with the fumes of hydrogen sulfide and sulfur dioxide, and it is here that Rick and Scotty help Dr. Brant and his scientist associates set up headquarters, in the hope of finding a way of controlling an eruption that is growing into a certainty with fantastic speed.</p>
<p>But their efforts to save the island town are hindered by the superior forces of nature, the superstitious fatalism of the people—and sabotage!</p>
<p>With the earth opening up all around them, Rick, Scotty, and the scientists have little hope of preventing a catastrophe, until a decision is made to unleash the awesome power of atomic energy in a desperate last attempt to fight the volcanic eruption.</p>
<p>Jam-packed with excitement and swift, tense action, The Flaming Mountain has all the elements that have made the Rick Brant Science Adventure series a favorite with boys all over the world.</p>
—
<h3>CHAPTER I</h3>
<h4>Vulcan's Hammer</h4>
<p class="section__text">The entire staff of the world-famed Spindrift Scientific Foundation gathered in the conference room of the big gray laboratory building on the southeast corner of Spindrift Island. It was unusual for the whole staff to be called to a meeting. Even more unusual—not a single member knew what the meeting was about.</p>
<p>Rick Brant, son of the Spindrift Foundation's director, Dr. Hartson Brant, was perhaps even more mystified than the professional scientists. His father had phoned from Florida with brief instructions. "Rick, I want you and Scotty to make a scale model of San Luz Island. It's off the coast of Venezuela. You'll find it on the sailing chart of the area, and there are references in the library. Be as complete and detailed as possible, and have the model ready by Saturday. Pick me up at Newark Airport Saturday noon. I'll have a guest. Ask Hobart Zircon to call a full staff meeting for two o'clock Saturday."</p>
<p>Rick and his pal Don Scott had completed the model, which was now resting on a table at the front of the lab conference room. One hour ago he had flown with Scotty in his plane, the Sky Wagon, to Newark Airport where he had picked up his father and a short, white-haired elderly man by the name of Dr. Esteben Balgos.</p>
</div>
<footer class="group footer">
<div class="pull">
<small>Images: <a href="http://unsplash.com">Unsplash</a></small>
</div>
<div class="push">
<small>Text: <a href="http://www.gutenberg.org/ebooks/32038">The Project Gutenberg</a></small>
</div>
</footer>
/**
* Imports and plugins
*/
@use postcss-custom-media;
@use postcss-nested;
@use postcss-simple-vars;
@import url('https://fonts.googleapis.com/css?family=Eczar:400,700|Gentium+Basic');
/**
* Base
*/
html {
height: 100%;
scroll-behavior: smooth;
}
body {
font-family: 'Eczar', sans-serif;
font-weight: 400;
}
h1, h2, h3, h4, h5, h6 {
font-family: "Eczar", sans-serif;
}
h2 {
font-family: "Eczar", sans-serif;
font-size: 26px;
font-weight: 700;
padding: 0;
margin: 56px 0 24px -1.883px;
text-align: left;
line-height: 34.5px;
letter-spacing: -0.45px;
}
p {
font-family: 'Gentium Basic', serif;
margin-top: 21px;
font-size: 21px;
letter-spacing: -0.03px;
line-height: 1.58;
}
a {
color: brown;
text-decoration: none;
&:hover {
font-weight: bold;
}
}
.footer {
color: white;
background-color: #d0bcab;
padding: 24px;
}
.section {
margin: 0 auto;
max-width: 650px;
padding: 0 24px;
&__text {
&::first-letter {
font-size: 32px;
}
}
}
/**
* Utils
*/
.group {
overflow: hidden;
}
.pull {
float: left;
}
.push {
float: right;
}
.container {
position: relative;
display: block;
width: 100%;
height: 100vh;
}
.hero {
position: relative;
display: block;
width: 100%;
height: 100vh;
&__image {
position: absolute;
width: 100%;
height: 100vh;
clip: rect(0, auto, auto, 0);
background-image: url(https://res.cloudinary.com/mihael/image/upload/v1548409393/codepen/hero.jpg);
background-attachment: fixed;
background-repeat: no-repeat;
background-size: cover;
&--overlay {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1;
background: linear-gradient(to bottom, rgba(121,85,72,0) 0%,rgba(121,85,72,0.17) 21%,rgba(121,85,72,0.5) 80%);
}
}
&__child {
position: fixed;
background-repeat: no-repeat;
backface-visibility: hidden;
opacity: .8;
&--primary {
top: -120px;
left: 50px;
width: 819px;
height: 1621px;
background-image: url(https://res.cloudinary.com/mihael/image/upload/v1548409393/codepen/cloud-2.png);
}
&--secondary {
top: 0;
right: 50px;
width: 300px;
height: 500px;
background-size: 300px auto;
background-image: url(https://res.cloudinary.com/mihael/image/upload/v1548409392/codepen/cloud-1.png);
}
}
&__title {
position: absolute;
bottom: 18vh;
left: 24vw;
right: 24vw;
z-index: 1;
opacity: 0;
font-size: calc(6px * 10);
line-height: calc(6px * 12);
color: white;
font-family: 'Eczar', sans-serif;
font-weight: 200;
text-align: center;
@media screen and (min-width: 768px) {
bottom: 15vh;
font-size: calc(6px * 16);
line-height: calc(6px * 18);
}
}
&__subtitle {
position: absolute;
bottom: 15vh;
left: 24vw;
right: 24vw;
color: white;
font-family: 'Gentium Basic', serif;
font-size: 24px;
line-height: 32px;
text-align: center;
}
}
/**
* Animation
*/
.animation {
&--floating {
animation-name: floating;
animation-duration: 200000ms;
animation-iteration-count: infinite;
}
&--title-in {
animation: title-in 800ms forwards ease-in-out 750ms;
}
&--from-top {
animation: from-top 350ms forwards cubic-bezier(0.65, 0.05, 0.36, 1);
}
&--from-bottom {
animation: from-bottom 350ms forwards cubic-bezier(0.65, 0.05, 0.36, 1);
}
}
/**
* Keyframes for specific animation
*/
@keyframes floating {
0% {
transform: translateY(0%);
}
50% {
transform: translateY(50%);
}
100% {
transform: translateY(0%);
}
}
@keyframes title-in {
0% {
visibility: hidden;
opacity: 0;
transform: translateY(-25%);
}
100% {
opacity: 1;
visibility: visible;
transform: translateY(0);
}
}
@keyframes from-top {
0% {
visibility: hidden;
opacity: 0;
transform: translateY(-30%);
}
100% {
opacity: 1;
visibility: visible;
transform: translateY(0);
}
}
@keyframes from-bottom {
0% {
visibility: hidden;
opacity: 0;
transform: translateY(15%);
}
100% {
opacity: 1;
visibility: visible;
transform: translateY(0);
}
}
Also see: Tab Triggers