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.
<article class="post">
<h2>Chapter Three: The Great American Game</h2>
<p>Dear Diary,</p>
<p>Grandfather's creaky as his front porch, loads his shotgun beneath the awning, spittoon restless for rain, carpenter's
chair against the whistling air. Rocking, back and forth, rocking snap shot picture - worth it, just like the movies</p>
<div class="tip tip-right">
<p>This is a song by
<a href="http://levithepoet.net/">Levi The Poet</a>
</p>
</div>
<p>She said that he loved baseball, and James Earl Jones; said that he's got god talking inside of his thoughts while he's
rounding those bases on his way back home</p>
<blockquote>
<p>"If you build it, they will come"</p>
</blockquote>
<p>If you build it, they will come (and baby listens to what the Lord say). But I've been getting pretty worn, building for
nearly a decade</p>
<figure>
<img src="https://source.unsplash.com/1000x300" alt="Big Ass Image">
<figcaption>Super Nice Photo</figcaption>
</figure>
<p>In a perfect world we shouldn’t have been allowed to lose sight of what it means to love wholly. I’ve got a Polaroid hanging
on my wall that a friend took of me and my angel. I remember the day like it’s something I can touch, but it’s stuck
in the square between the borders of the film, and I can run my fingers over our faces, but I can’t get back to the places
we were</p>
<blockquote>
<p>You’ve got a pain deep in your bones, son.</p>
</blockquote>
<p>"You’ve got a pain deep in your bones, son. It compels you forward like you’re tied to a slave master’s cruel hand, and
it's the same pain that drives that oppressor’s heart of stone, so you’ve grown to love the man. You keep pouring yourself
out, again and again, into legible lines through a crooked pen." Yeah, it’s painful, but it’s familiar – so habit breeds
comfort, and I don’t know what I’d do without him</p>
<div class="tip tip-left">
<p>You can listen to this song on
<a href="https://www.youtube.com/watch?v=-gvpej9TT-g">YouTube</a>
</p>
</div>
<p>So in the early morning, when you’ve fallen asleep in our home, I drift back into the memories that I’ve claimed as my
own, and wonder if tonight will be a night I’ll hang on my wall like I did before we stopped taking photos, out of the
habit of being comfortable with not trying at all</p>
<p>In a perfect world, we’ll have albums labeled Seasons, with chapter headings, and we’ll staple them to the cork-board that
hangs at the foot of the bed. There’s longevity in a memory spilt out in pen, and if a picture is worth a thousand words
then I’ve written down every one of them</p>
<p>I work hard, scarred, toil through that soil for the youth I see in my friends, but these journals are moments in time,
snapshots of our lives, and in retrospect, age is an overexposed photo that the memories can't mend</p>
<div class="tip tip-right">
<img src="https://f4.bcbits.com/img/a1057026609_16.jpg" alt="Correspondence Album Cover">
<p>Buy the album on
<a href="https://levithepoet.bandcamp.com/album/correspondence-a-fiction">BandCamp</a>
</p>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Molestiae totam quia vel eveniet porro, rem ducimus quam incidunt,
dicta laborum quod earum tempore natus placeat neque aspernatur pariatur iusto quos.</p>
</div>
<p>I know my sweet seductress, and her name is Depression. I wrote best beneath that demon’s destructive oppression</p>
<p>In those Polaroids, she drove the ink into the canvas like a slave beneath his master’s cruel hand, and I hated that whip
but always wondered what I’d do without it, so I grew to love the man</p>
<p>Oh, I wept for change! I begged for movement and the good Lord, he answered my prayers, but you don’t know how to breathe
easy when you let go of your habits, even if your comforts left you gasping for air</p>
<figure>
<img src="https://source.unsplash.com/1000x700" alt="Big Ass Image">
<figcaption>Super Nice Photo</figcaption>
</figure>
<h2>Dear Time</h2>
<p>Grandfather's as creaky as his front porch, scent like oil in the gun barrel, dip-can kicked over the railing, sandpaper
hands stuck behind thumb tacks on my wall. I’ve got an ache in my chest for every season I miss and it gets worse when
the snow starts to fall. There are butterflies alive in that couple’s eyes a few years since forgotten by all, and sometimes,
if the phone starts to ring, I can still hear their wings when you call</p>
<p>But I begged for movement and I got what I asked for, and I can picture the answer like it came yesterday. And in the land
of the gods, I think that things are timeless, but we are still prone to decay</p>
<p>You know I still lift up hope of certain smiles in those photos for us when I pray</p>
<blockquote>
<p>"Idle hands build nothing that you can call your own"</p>
</blockquote>
<p>Time is a cruel lover, and she breaks her house apart at its bones. You know comfort is no good reason for standing still,
and idle hands build nothing that you can call your own.</p>
<blockquote>
<p>— Levi The Poet</p>
</blockquote>
</article>
:root {
--yellow: #ffc600;
}
html {
color: #444;
font-family: Cambria, Cochin, Georgia, 'Times New Roman', Times, serif;
font-size: 20px;
}
p {
line-height: 1.8;
}
img {
max-width: 100%;
}
a {
color: black;
text-decoration: underline wavy var(--yellow);
}
h1,
h2 {
font-size: 80px;
font-style: italic;
font-weight: 100;
margin: 0;
}
.post {
display: grid;
max-width: 1000px;
margin: 200px auto;
grid-template-columns: 3fr 12fr 5fr;
grid-gap: 10px 20px;
}
.post > * {
grid-column: 2 / -2;
}
.post > figure {
margin: 0;
grid-column: 1 / -1;
}
figcaption {
font-size: 12px;
}
.post > blockquote {
grid-column: 1 / -1;
font-size: 60px;
margin: 0;
font-style: italic;
text-align: center;
}
.tip {
background: #EBEBEB;
padding: 10px;
grid-row: span 5;
align-self: start;
}
.tip-left {
grid-column: 1 / span 1;
text-align: right;
border-right: 2px solid var(--yellow);
}
.tip-right {
grid-column: span 1 / -1;
border-left: 2px solid var(--yellow);
}
Also see: Tab Triggers