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.
.container
.instruction Hover the paragraphs to see the effect 👀
h1 HIGHLIGHT 📝
.content.v2
p Woah, That's pretty cool, Gotta remember that ! I'm just gonna highlight this for future reference. Who knows I might forget this. Better not forget this. I wish my memory was better, But oh well, that's that.
h1 SPOILERS 💩
.content.v3
p This season is gonna blow your mind ! Like this season is crazy dawg! You know what happens on the first episode ? You are not gonna believe me bro, like It's crazy dude !
h1 UNDERLINE 🍧
.content.v1
p This thing is really really important, you don't wanna miss this. Trust me. This is like really really important. like really really.
h1 DASHES 😎
.content.v4
p I dont' know dude, May be this could be important, May be not, who knows? I don't know, Do you know? Do you know somebody that knows this maybe, call me maybe.
h1 SEE DELETED 🙈
.content.v5
p Remember when I told you about this thing back in the day, when I was younger, you know those days right? Well guess what, I was totally wrong about that. Heh, This is embarassing
h1 SEE DELETED 🙈2
.content.v6
p Hold on, Hold on. May be I WAS right at the time, they just changed the stuff now. Like I didn't know this was gonna happen, but now that It did, Well I guess I have to remove this now..
h1 CRAZY LINES 🤡
.content.v7
p YO! What's up everybody, It's ya-boi Shloopy Mcfloopy-face, back at it again with the new stuff! This time it's gon-be liiiittt, son ! Hit that Subscribbe Button, Smash that bell! See you guys on the next video
h1 SWIPE 🎨
.content.v8
p Here is the point, This point of mine is Striking, It is powerful. It is important. I have the data to back that up, Statistics show that this point of mine is indeed true. A Study conducted in 2015 proves that I have been right all along, what you gonna do about it huh?
yellow = #f6e05e
red = #e53e3e
grey = #a0aec0
purple = #4834d4
body
font-family Arial
font-size 1.5rem
line-height 150%
background #edf2f7
color #2d3748
.container
max-width 600px
margin 0 auto
padding 1em
h1
font-size 2.2rem
.instruction
font-size 1.8rem
margin-bottom 4rem
font-style italic
.content
margin-bottom 4em
p
display inline
background-repeat no-repeat
transition all 500ms ease-in-out
// UNDERLINE--------------------------------
.v1
thickness = 5px
p
background-position bottom left
background-size 0% thickness
background-image linear-gradient(red, red)
padding-bottom thickness
&:hover
p
background-size 100% thickness
// HIGHLIGHT --------------------------------
.v2
p
background-position left
background-size 0% 100%
background-image linear-gradient(yellow, yellow)
&:hover
p
background-size: 100% 100%
// SPOILERS ------------------------------------------
.v3
p
color transparent
background-position right
background-size 100% 100%
background-image linear-gradient(grey, grey)
&:hover
p
color black
background-size 0% 100%
// DASHES -------------------------------------
.v4
thickness = 3px
p
background-position bottom left
background-size 0% thickness
background-image repeating-linear-gradient(to right, purple 0 thickness, transparent 0 (2*thickness))
padding-bottom thickness
&:hover
p
background-size 100% thickness
// DELETED v1-------------------------------------
.v5
thickness = 3px
p
background-position center left
background-size 100% thickness
background-image linear-gradient(to right, black, black)
padding-bottom thickness
&:hover
p
background-size 100% 100%
color white
background-image linear-gradient(to right, red, red)
// DELETED v2-------------------------------------
.v6
thickness = 4px
p
background-position center left
background-size 100% thickness
background-image linear-gradient(to right, black, black)
padding-bottom thickness
&:hover
p
background-position bottom left
background-size 100% (thickness/2)
font-style italic
// CRAZY -------------------------------------
.v7
p
background-position left
background-size 0% 100%
background-image linear-gradient(to right, yellow, yellow)
&:hover
p
background-position right
background-size 100% 100%
// SWIPE -------------------------------------
.v8
thickness = 4px
p
background-position left
background-size 0% 100%
background-image linear-gradient(to right, #9ae6b4, yellow)
padding-bottom thickness
box-decoration-break clone
-webkit-box-decoration-break clone
&:hover
p
background-size 100% 100%
Also see: Tab Triggers