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 URL's added here will be added as <link>
s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.
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.
If the stylesheet 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 CSS 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.
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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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.
<p>Daddy Bender, we're hungry. Dear God, they'll be killed on our doorstep! And there's no trash pickup until January 3rd. Good news, everyone! I've taught the toaster to feel love! For example, if you killed your grandfather, you'd cease to exist!</p>
<h1>The alien mothership is in orbit here. If we can hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate.</h1>
<div class="ss_box">
<h1>This is a wee box</h1>
</div>
<div class="ss_box ss_book">
<h1>This is a book box</h1>
</div>
<a href="https://zslabs.com/articles/fluid-sizes">Stolen/Forked from Zach Schnackel</a>
<p>There's one way and only one way to determine if an animal is intelligent. Dissect its brain! With gusto. It's toe-tappingly tragic! <strong> I don't 'need' to drink.</strong> <em> I can quit anytime I want!</em> Kids have names?</p>
<h2>They're like sex, except I'm having them!</h2>
<p>You, a bobsleder!? That I'd like to see! And when we woke up, we had these bodies. Can I use the gun? What are you hacking off? Is it my torso?! 'It is!' My precious torso! Oh dear! She's stuck in an infinite loop, and he's an idiot! Well, that's love for you.</p>
<img src="https://images.pexels.com/photos/2191040/pexels-photo-2191040.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" alt="">
<ol>
<li>Anyhoo, your net-suits will allow you to experience Fry's worm infested bowels as if you were actually wriggling through them.</li><li>I guess because my parents keep telling me to be more ladylike. As though!</li><li>We're also Santa Claus!</li>
</ol>
<h3>It must be wonderful.</h3>
<p>Why would a robot need to drink? Hey, tell me something. You've got all this money. How come you always dress like you're doing your laundry? Is today's hectic lifestyle making you tense and impatient?</p>
<ul>
<li>And so we say goodbye to our beloved pet, Nibbler, who's gone to a place where I, too, hope one day to go. The toilet.</li><li>Leela's gonna kill me.</li><li>You'll have all the Slurm you can drink when you're partying with Slurms McKenzie!</li>
</ul>
<p>I'll get my kit! I don't know what you did, Fry, but once again, you screwed up! Now all the planets are gonna start cracking wise about our mamas. Throw her in the brig. I love this planet! I've got wealth, fame, and access to the depths of sleaze that those things bring.</p>
<p>There's no part of that sentence I didn't like! Kif, I have mated with a woman. Inform the men. Belligerent and numerous. In our darkest hour, we can stand erect, with proud upthrust bosoms. This is the worst part. The calm before the battle.</p>
<p>I don't 'need' to drink. I can quit anytime I want! That's a popular name today. Little "e", big "B"? I daresay that Fry has discovered the smelliest object in the known universe! Pansy.</p>
<p>Look, everyone wants to be like Germany, but do we really have the pure strength of 'will'? Tell her you just want to talk. It has nothing to do with mating. Tell them I hate them. Hey, guess what you're accessories to.</p>
<p>Look, last night was a mistake. I'm sorry, guys. I never meant to hurt you. Just to destroy everything you ever believed in. There's no part of that sentence I didn't like! Large bet on myself in round one.</p>
<p>Okay, I like a challenge. Oh dear! She's stuck in an infinite loop, and he's an idiot! Well, that's love for you. You seem malnourished. Are you suffering from intestinal parasites? I'll tell them you went down prying the wedding ring off his cold, dead finger.</p>
<p>Noooooo! Come, Comrade Bender! We must take to the streets! She also liked to shut up! You don't know how to do any of those. You guys aren't Santa! You're not even robots. How dare you lie in front of Jesus?</p>
<p>Yep, I remember. They came in last at the Olympics, then retired to promote alcoholic beverages! I love this planet! I've got wealth, fame, and access to the depths of sleaze that those things bring. Bender, we're trying our best.</p>
<p>We can't compete with Mom! Her company is big and evil! Ours is small and neutral! I can explain. It's very valuable. Say what? Can I use the gun? Say what?</p>
<p>Now what? We're also Santa Claus! Goodbye, friends. I never thought I'd die like this. But I always really hoped. A sexy mistake.</p>
<p>What are their names? I love this planet! I've got wealth, fame, and access to the depths of sleaze that those things bring. No! Don't jump! Pansy. Oh, I think we should just stay friends.</p><h1>The alien mothership is in orbit here. If we can hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate.</h1>
<a href="https://zslabs.com/articles/fluid-sizes">Stolen/Forked from Zach Schnackel</a>
<p>Daddy Bender, we're hungry. Dear God, they'll be killed on our doorstep! And there's no trash pickup until January 3rd. Good news, everyone! I've taught the toaster to feel love! For example, if you killed your grandfather, you'd cease to exist!</p>
<p>There's one way and only one way to determine if an animal is intelligent. Dissect its brain! With gusto. It's toe-tappingly tragic! <strong> I don't 'need' to drink.</strong> <em> I can quit anytime I want!</em> Kids have names?</p>
<h2>They're like sex, except I'm having them!</h2>
<p>You, a bobsleder!? That I'd like to see! And when we woke up, we had these bodies. Can I use the gun? What are you hacking off? Is it my torso?! 'It is!' My precious torso! Oh dear! She's stuck in an infinite loop, and he's an idiot! Well, that's love for you.</p>
<img src="https://images.pexels.com/photos/2191040/pexels-photo-2191040.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" alt="">
<ol>
<li>Anyhoo, your net-suits will allow you to experience Fry's worm infested bowels as if you were actually wriggling through them.</li><li>I guess because my parents keep telling me to be more ladylike. As though!</li><li>We're also Santa Claus!</li>
</ol>
<h3>It must be wonderful.</h3>
<p>Why would a robot need to drink? Hey, tell me something. You've got all this money. How come you always dress like you're doing your laundry? Is today's hectic lifestyle making you tense and impatient?</p>
<ul>
<li>And so we say goodbye to our beloved pet, Nibbler, who's gone to a place where I, too, hope one day to go. The toilet.</li><li>Leela's gonna kill me.</li><li>You'll have all the Slurm you can drink when you're partying with Slurms McKenzie!</li>
</ul>
<p>I'll get my kit! I don't know what you did, Fry, but once again, you screwed up! Now all the planets are gonna start cracking wise about our mamas. Throw her in the brig. I love this planet! I've got wealth, fame, and access to the depths of sleaze that those things bring.</p>
<p>There's no part of that sentence I didn't like! Kif, I have mated with a woman. Inform the men. Belligerent and numerous. In our darkest hour, we can stand erect, with proud upthrust bosoms. This is the worst part. The calm before the battle.</p>
<p>I don't 'need' to drink. I can quit anytime I want! That's a popular name today. Little "e", big "B"? I daresay that Fry has discovered the smelliest object in the known universe! Pansy.</p>
<p>Look, everyone wants to be like Germany, but do we really have the pure strength of 'will'? Tell her you just want to talk. It has nothing to do with mating. Tell them I hate them. Hey, guess what you're accessories to.</p>
<p>Look, last night was a mistake. I'm sorry, guys. I never meant to hurt you. Just to destroy everything you ever believed in. There's no part of that sentence I didn't like! Large bet on myself in round one.</p>
<p>Okay, I like a challenge. Oh dear! She's stuck in an infinite loop, and he's an idiot! Well, that's love for you. You seem malnourished. Are you suffering from intestinal parasites? I'll tell them you went down prying the wedding ring off his cold, dead finger.</p>
<p>Noooooo! Come, Comrade Bender! We must take to the streets! She also liked to shut up! You don't know how to do any of those. You guys aren't Santa! You're not even robots. How dare you lie in front of Jesus?</p>
<p>Yep, I remember. They came in last at the Olympics, then retired to promote alcoholic beverages! I love this planet! I've got wealth, fame, and access to the depths of sleaze that those things bring. Bender, we're trying our best.</p>
<p>We can't compete with Mom! Her company is big and evil! Ours is small and neutral! I can explain. It's very valuable. Say what? Can I use the gun? Say what?</p>
<p>Now what? We're also Santa Claus! Goodbye, friends. I never thought I'd die like this. But I always really hoped. A sexy mistake.</p>
<p>What are their names? I love this planet! I've got wealth, fame, and access to the depths of sleaze that those things bring. No! Don't jump! Pansy. Oh, I think we should just stay friends.</p>
///
/// @param {variable} $property [font-size]
/// @param {variable} $min-size [12px]
/// @param {variable} $max-size [24px]
/// @param {variable} $lower-range [480px] - Stop scaling smaller at this screen resolution
/// @param {variable} $upper-range [960px] - Stop scaling larger at this screen resolution
///
@mixin fluid-size(
$property: 'font-size',
$min-size: 12px,
$max-size: 24px,
$lower-range: 480px,
$upper-range: 1300px
) {
#{$property}: calc(
#{$min-size} + #{(
($max-size / ($max-size * 0 + 1)) - ($min-size / ($min-size * 0 + 1))
)} *
(
(100vw - #{$lower-range}) / #{(
($upper-range / ($upper-range * 0 + 1)) - ($lower-range /
($lower-range * 0 + 1))
)}
)
);
@media (max-width: $lower-range) {
#{$property}: $min-size ;
}
@media (min-width: $upper-range) {
#{$property}: $max-size ;
}
}
$font-size: 40px;
// Example
h1, h3 {
@include fluid-size('padding', 0px, 100px);
@include fluid-size('font-size', $font-size, 100px);
@include fluid-size('line-height', $font-size, $font-size * 4 );
}
a,span,li,p,div
{
@include fluid-size('font-size', 18px, 40px);
@include fluid-size('line-height', 120%, 130%);
@include fluid-size('margin-bottom', 10px, 40px);
}
img
{
@include fluid-size('border-top-width', 10px, 40px);
@include fluid-size('border-right-width', 10px, 40px);
@include fluid-size('border-bottom-width', 10px, 40px);
@include fluid-size('border-left-width', 10px, 40px);
max-width: 100vw;
max-height: 100vh;
height: 400px;
margin: 0 auto;
display: block;
border-color: black;
border-style: solid;
}
@import url('https://fonts.googleapis.com/css?family=Montserrat|Roboto+Slab');
body
{
h1, h2, h3, h4, h5, h6
{
font-family: "Montserrat";
}
a,span,li,p,div
{
font-family: "Roboto Slab";
}
}
.ss_box
{
font-size: 70% !important;
background: beige;
h1
{
@include fluid-size('font-size', 11px, 11px * 3 );
}
}
.ss_book *
{
font-size: 90%;
}
Also see: Tab Triggers