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.
<h2>Announcement</h2>
<img class="megaphone" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/409269/megaphone.png">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laborum aspernatur pariatur eius, in neque quibusdam dignissimos ratione veniam! Laborum quis unde fuga quibusdam iste voluptas dolorum, doloremque illum molestias sint. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Debitis necessitatibus alias unde rem quae soluta consectetur. Reprehenderit dolorum ducimus at itaque, sapiente ea eligendi, excepturi quibusdam. Inventore suscipit, ex voluptas?Lorem ipsum dolor sit amet, consectetur adipisicing elit. Libero officia ipsam aliquam nihil vitae, quasi. Perferendis ullam tempora totam dolore optio minima, laudantium nemo corporis tenetur non, et mollitia hic.Lorem ipsum dolor sit amet, consectetur adipisicing elit. Corporis soluta est neque aut eveniet nostrum libero laborum esse, aspernatur eligendi! Culpa nemo voluptates saepe pariatur ea. Minus odit in ad.Lorem ipsum dolor sit amet, consectetur adipisicing elit. Non laboriosam aliquid quis ipsa eos excepturi, facere vel, saepe accusantium. Pariatur hic enim eaque corporis nostrum labore laborum eligendi fuga magni.</p>
<img class="desktop" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/409269/desktop01.png">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Non voluptate vitae, eligendi eveniet suscipit earum est expedita inventore aliquam perspiciatis deleniti neque distinctio quidem quam quibusdam. Laborum expedita neque repudiandae.Lorem ipsum dolor sit amet, consectetur adipisicing elit. Autem ad est voluptate sint fugiat quos illum, beatae neque repellendus eius saepe dolorem obcaecati expedita, ea et quas quisquam suscipit amet.Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iusto odit incidunt, deleniti veniam quasi quos illo aliquam facere velit, nulla magni, placeat? Adipisci quisquam vel, ab quo at veniam ipsa.Lorem ipsum dolor sit amet, consectetur adipisicing elit. Illo omnis debitis vitae quae nulla itaque in sequi quas natus deserunt repudiandae, molestiae necessitatibus non minima dolores, velit officia. Commodi, mollitia! Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptas debitis, eaque nostrum, ratione delectus rerum doloremque voluptatem nam repellat ipsam doloribus aliquam quibusdam, quasi minima magnam consequuntur? Repellat, odio, nisi.Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quaerat maiores officia adipisci eos. Similique excepturi fugit et quis perferendis sunt dolorem optio! Possimus rerum iure laborum, reprehenderit harum culpa ipsa?</p>
<img class="logo" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/409269/Acme_Insignia.png">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iusto voluptate, eaque at expedita molestias nemo amet eum! Distinctio a pariatur, ut fugit iure minima nesciunt, eius tenetur officia, excepturi odio.Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sapiente nulla cupiditate et provident, error numquam saepe odio accusamus recusandae explicabo deleniti sed quod similique rerum minus magnam consectetur laboriosam veniam!Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aut voluptates voluptate ipsa ullam sapiente eveniet cum nostrum, facilis totam provident fugit quibusdam, ea iusto incidunt non corporis labore omnis accusamus!Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos, expedita. Obcaecati commodi ullam ratione eum quod nam assumenda ex at et incidunt, ab, est, recusandae quasi nisi voluptates sit repudiandae?Lorem ipsum dolor sit amet, consectetur adipisicing elit. Debitis blanditiis quidem at vero modi illo ea similique dicta amet nemo! Alias natus ipsam soluta commodi maiores vero atque illo veritatis?</p>
body { font-family: sans-serif; font-size: 18px; }
Also see: Tab Triggers