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.
<h1>A Connecticut Yankee in King Arthur's Court</h1>
<p class="author">by Mark Twain</p>
<h2>Chapter One</h2>
<h3>Camelot</h3>
<p class="first">"Camelot — Camelot," said I to myself. "I don't seem to remember hearing of it before. Name of the asylum, likely."</p>
<p>It was a soft, reposeful summer landscape, as lovely as a dream, and as lonesome as Sunday. The air was full of the smell of flowers, and the buzzing of insects, and the twittering of birds, and there were no people, no wagons, there was no stir of life, nothing going on. The road was mainly a winding path with hoof-prints in it, and now and then a faint trace of wheels on either side in the grass--wheels that apparently had a tire as broad as one's hand.</p>
<p>Presently a fair slip of a girl, about ten years old, with a cataract of golden hair streaming down over her shoulders, came along. Around her head she wore a hoop of flame-red poppies. It was as sweet an outfit as ever I saw, what there was of it. She walked indolently along, with a mind at rest, its peace reflected in her innocent face. The circus man paid no attention to her; didn't even seem to see her. And she--she was no more startled at his fantastic make-up than if she was used to his like every day of her life.</p>
<p>She was going by as indifferently as she might have gone by a couple of cows; but when she happened to notice me, then there was a change! Up went her hands, and she was turned to stone; her mouth dropped open, her eyes stared wide and timorously, she was the picture of astonished curiosity touched with fear. And there she stood gazing, in a sort of stupefied fascination, till we turned a corner of the wood and were lost to her view.</p>
<p>That she should be startled at me instead of at the other man, was too many for me; I couldn't make head or tail of it. And that she should seem to consider me a spectacle, and totally overlook her own merits in that respect, was another puzzling thing, and a display of magnanimity, too, that was surprising in one so young. There was food for thought here. I moved along as one in a dream.</p>
body { font-family: Georgia, Times, "Times New Roman", "Liberation Serif", serif; }
h1 { font-variant: small-caps; }
h1, h2, h3 { text-align: center; }
.author {
font-size: 1.2em;
font-style: italic;
text-align: right;
letter-spacing: .1em;
}
.first {
font-size: 1.2em;
font-style: italic;
line-height: 1.5;
word-spacing: .1em;
}
p + p { text-indent: 1em; }
Also see: Tab Triggers