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.
h2 Lorem ipsum dolor sit amet, consectetur adipiscing elit.
p Pellentesque eu dignissim tellus. Curabitur ut finibus justo. Morbi nec aliquam est. Proin hendrerit enim dolor. Aliquam sed enim facilisis, egestas ante eget, eleifend nibh. Mauris ullamcorper, sapien vitae porttitor malesuada, ex enim commodo metus, sollicitudin lobortis lacus magna quis metus. Maecenas nec urna dignissim, commodo ex et, egestas erat. Etiam pharetra purus hendrerit feugiat pellentesque. Maecenas non facilisis quam. Mauris quis orci consectetur, imperdiet sapien non, rhoncus augue. Vivamus sed vulputate nunc, at semper ex. Nunc et tempor quam, ac cursus quam. Maecenas elementum hendrerit ligula. Nulla facilisi. Proin sit amet ligula id massa gravida lacinia eget sed dui. Integer vitae euismod enim.
p Praesent id orci erat. Nullam ac nisl convallis, semper urna nec, posuere nunc. Aliquam dictum efficitur eros, sit amet pretium turpis imperdiet eget. Vivamus congue justo ut faucibus rhoncus. Cras lobortis diam vel felis suscipit, id egestas ligula consequat. Suspendisse maximus scelerisque eros non finibus. Donec ac luctus sapien. Aenean a tincidunt elit, sed vehicula magna. Integer ante leo, pulvinar ac lorem ut, volutpat cursus elit. In gravida malesuada commodo.
p Aliquam nulla velit, hendrerit et viverra nec, fermentum sed est. Nulla facilisi. Suspendisse potenti. Nunc id metus eget augue porta ultricies. Duis ut accumsan erat. Morbi sed mauris a urna mollis faucibus non molestie orci. Nunc suscipit nec felis nec euismod.
p Sed justo leo, elementum non lacinia sit amet, molestie nec diam. Duis id magna pretium, molestie est ut, semper nulla. Maecenas finibus nulla purus, ac convallis leo luctus nec. Aenean eu mollis nisl, ac scelerisque sapien. In dignissim sem neque, et pellentesque nisi gravida et. In faucibus sapien quis metus aliquet ultrices. Proin facilisis consequat eleifend. Phasellus quam augue, dignissim eget egestas ut, suscipit a urna. Aliquam eget efficitur risus. Nullam congue in lorem a aliquet. Morbi rutrum finibus odio, vel sagittis libero facilisis vitae. Nam in laoreet odio. Donec sagittis auctor sem a fringilla.
p Nullam bibendum ex quis facilisis pellentesque. Phasellus mollis nulla nibh, ut rhoncus augue aliquam commodo. Nulla aliquam iaculis ante, ac dignissim felis imperdiet sit amet. Praesent non sodales diam. Vestibulum rhoncus, est et mattis volutpat, arcu urna viverra diam, consectetur dapibus erat nulla nec quam. Nullam eu lobortis lacus. Praesent sit amet magna tincidunt, sodales quam at, rutrum lorem.
html {
font-size: 62.5%;
}
body {
max-width: 80rem;
padding: 4.8rem 2.4rem;
margin: 0 auto;
font-size: 1.6rem;
line-height: 1.5;
font-family: sans-serif;
}
h2 {
font-size: 2.4rem;
font-weight: 500;
}
p {
margin: 1.6rem 0;
}
@media (prefers-color-scheme: light) {
body {
background-color: #FFF;
color: #000;
}
}
@media (prefers-color-scheme: dark) {
body {
background: #000;
color: #FFF;
}
}
Also see: Tab Triggers