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="content">
<p>So you two dig up, dig up dinosaurs? Do you have any idea how long it takes those cups to decompose. Hey, take a look at the earthlings. <a href="#">Goodbye</a>! Yes, Yes, without the <a href="#">oops</a>! </p>
<div class="bleed-out">
<img src="https://source.unsplash.com/JzDB79tc6ic/1920x1080" title="Bleeding-out image featuring dinosaurs" alt="Bleeding-out image featuring dinosaurs">
</div>
<p>Must go faster. You're a very talented young man, with your own clever thoughts and ideas. Do you need a manager?</p>
<p>God creates dinosaurs. God destroys dinosaurs. God creates Man. Man destroys God. Man creates Dinosaurs. Yeah, but your scientists were so preoccupied with whether or not they could, they didn't stop to think if they should. You're a very talented young man, with your own clever thoughts and ideas. Do you need a manager?</p>
<p>You know what? It is beets. I've crashed into a beet truck. You really think you can fly that thing? I was part of something special. Remind me to thank John for a lovely weekend. God creates dinosaurs. God destroys dinosaurs. God creates Man. Man destroys God. Man creates Dinosaurs.</p>
<p>You know what? It is beets. I've crashed into a beet truck. Yeah, but your scientists were so preoccupied with whether or not they could, they didn't stop to think if they should. Hey, take a look at the earthlings. Goodbye! My dad once told me, laugh and the world laughs with you, Cry, and I'll give you something to cry about you little bastard!</p>
<p>Eventually, you do plan to have dinosaurs on your dinosaur tour, right? So you two dig up, dig up dinosaurs? Remind me to thank John for a lovely weekend. Must go faster. Checkmate... Life finds a way. Must go faster. Life finds a way. Remind me to thank John for a lovely weekend.</p>
<p>Remind me to thank John for a lovely weekend. Jaguar shark! So tell me - does it really exist? You're a very talented young man, with your own clever thoughts and ideas. Do you need a manager? You're a very talented young man, with your own clever thoughts and ideas. Do you need a manager?</p>
<p>We gotta burn the rain forest, dump toxic waste, pollute the air, and rip up the OZONE! 'Cause maybe if we screw up this planet enough, they won't want it anymore! Forget the fat lady! You're obsessed with the fat lady! Drive us out of here! Did he just throw my cat out of the window?</p>
<p>We gotta burn the rain forest, dump toxic waste, pollute the air, and rip up the OZONE! 'Cause maybe if we screw up this planet enough, they won't want it anymore! What do they got in there? King Kong? They're using our own satellites against us. And the clock is ticking.</p>
<p>Just my luck, no ice. You're a very talented young man, with your own clever thoughts and ideas. Do you need a manager? Must go faster. You're a very talented young man, with your own clever thoughts and ideas. Do you need a manager? Remind me to thank John for a lovely weekend.</p>
<p>You know what? It is beets. I've crashed into a beet truck. Forget the fat lady! You're obsessed with the fat lady! Drive us out of here! Hey, take a look at the earthlings. Goodbye! Jaguar shark! So tell me - does it really exist? This thing comes fully loaded. AM/FM radio, reclining bucket seats, and... power windows.</p>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Odit sed quaerat expedita quo, dicta accusamus magnam quae, molestiae beatae dolorum esse nemo incidunt? Ad impedit molestiae non obcaecati repellat necessitatibus?</p>
<p>Impedit vero consequuntur sunt, maiores suscipit labore delectus nihil autem nobis, cumque mollitia ipsam optio quaerat. Molestias magni blanditiis asperiores molestiae porro voluptatem, dolorem sapiente rerum accusantium eveniet explicabo? Corrupti.</p>
<p>Necessitatibus rerum veniam impedit accusantium! Itaque minus ea, aliquam optio natus obcaecati. Necessitatibus velit dolorem sunt, provident ullam vero deleniti non nisi nam perferendis dolorum officiis vel, accusamus cumque similique.</p>
<p>Sed aperiam illum iusto? Id, voluptatibus, non maxime fuga, repudiandae sapiente tempore possimus reprehenderit quos doloribus quod quibusdam iusto quas labore consequuntur blanditiis neque voluptas. Quaerat libero harum cumque velit.</p>
<p>Dolor, adipisci a. Unde sit sed laborum libero, molestiae ipsam quisquam modi, velit quaerat nesciunt quo fugiat quis magni hic odit temporibus quod laudantium laboriosam esse? Eaque vel debitis possimus!</p>
<p>Sunt, ea similique nemo quos facere, in harum natus aliquam dolores optio eaque reiciendis dolore nam enim et vitae numquam deleniti. Assumenda, aspernatur? Modi at est cumque quaerat consequuntur incidunt.</p>
<p>Provident illum, asperiores explicabo recusandae, dolores maiores maxime facilis repudiandae odio, odit ipsum. Quos cumque veritatis temporibus quas, cupiditate odit voluptatem veniam omnis reiciendis reprehenderit architecto nemo voluptatibus quis beatae.</p>
<p>Asperiores quod neque obcaecati, recusandae enim facere, beatae unde provident fugit accusantium saepe eaque delectus veritatis nisi aperiam non tempore doloremque velit assumenda ea cum nihil, voluptate libero? Fugiat, voluptatem.</p>
<p>Voluptate velit iste animi voluptas obcaecati eos modi, quibusdam mollitia delectus? Officia non, reprehenderit commodi dolore incidunt cum perferendis maiores fugit nostrum placeat pariatur neque expedita dolor aut sit dolorum.</p>
<p>Numquam, reprehenderit harum vel ullam, debitis libero alias tenetur in maxime explicabo animi laborum rerum molestiae atque deserunt necessitatibus eum autem unde recusandae, voluptatum temporibus optio eligendi veniam possimus? Eos.</p>
</div>
:root {
font-size: 100%;
box-sizing: border-box;
--hue: 210;
}
*,
*::before,
&::after {
box-sizing: inherit;
}
body {
font: 1em/1.618 'Libre Baskerville', serif;
color: hsl(var(--hue) 25% 25%);
}
img {
max-width: 100%;
vertical-align: middle;
}
a {
color: hsl(var(--hue) 5% 5%);
}
a:hover,
a:focus,
a:active {
color: hsl(var(--hue) 50% 50%);
}
p:not(:last-child) {
margin-bottom: 1em;
}
.content {
padding: 2em;
max-width: 500px;
margin-inline: auto;
}
.bleed-out {
margin-block: 2em;
padding: .5em;
border-radius: .5em;
width: 75vw;
background-color: hsl(var(--hue) 50% 80%);
position: relative;
left: 50%;
transform: translateX(-50%);
}
const bottomSheet = document.querySelector("#bottom-sheet"),
root = document.documentElement,
trigger = document.querySelector("#bottom-sheet-trigger")
if(bottomSheet) {
const close = bottomSheet.querySelector("#close-bottom-sheet")
trigger.addEventListener('click', e => {
bottomSheet.classList.add("bottom-sheet--active")
root.classList.add("is-bottom-sheet-active")
})
close.addEventListener('click', e => {
bottomSheet.classList.remove("bottom-sheet--active")
root.classList.remove("is-bottom-sheet-active")
})
}
Also see: Tab Triggers