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 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.
<article>
<h1>Lorem Ipsum Dolor</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sollicitudin laoreet fermentum. Quisque sed urna ultricies, iaculis diam a, vulputate eros. Vestibulum consectetur condimentum iaculis. Sed tempus diam enim, eu ullamcorper erat gravida at. Praesent lacus tellus, ornare quis imperdiet sit amet, vehicula id eros. Sed cursus odio eget sapien molestie aliquet. Cras vel lorem in dolor finibus rutrum. Aenean imperdiet nunc libero, eu venenatis neque maximus vel. Proin facilisis dolor id nunc feugiat tristique.</p>
<p>Nunc id ullamcorper ex. Morbi elementum sapien ultricies massa mattis pharetra eget et enim. Etiam congue malesuada commodo. Sed laoreet tempus lorem a posuere. Vestibulum cursus, ipsum eu efficitur venenatis, risus purus semper sem, ut mollis ex nulla et lorem. Praesent eleifend finibus est et molestie. Curabitur egestas mauris vitae elementum laoreet. Maecenas vitae molestie nibh, vel consequat purus. Phasellus faucibus porta odio id scelerisque. Sed non dui mauris.</p>
<img src="http://lorempixel.com/640/320/cats/4/" alt="cat picture" title="from lorempixel.com/"/>
<p>Vivamus et metus nibh. Vivamus eu porta urna. Curabitur sed dui volutpat, viverra quam suscipit, hendrerit ipsum. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus massa velit, semper vitae massa sed, egestas imperdiet turpis. Aenean id elit nulla. Sed sit amet ultrices velit. In hac habitasse platea dictumst. Etiam ornare turpis a venenatis rutrum. Nam imperdiet arcu non commodo vulputate. Proin sit amet blandit enim. Maecenas ultrices urna eget bibendum scelerisque. Donec sem libero, elementum sed pellentesque quis, luctus sed diam. Ut egestas nisi ligula, ac semper orci tincidunt sit amet. Proin vulputate vulputate lacinia.</p>
<p>Vivamus imperdiet, nisl ut dapibus vestibulum, dui leo porttitor dui, non consectetur nibh neque et mi. Sed ultrices dolor et est congue tristique. Sed sed volutpat nibh. Nunc pretium neque tellus, eget condimentum tellus sagittis quis. In vel turpis ac lectus suscipit congue vel at nunc. Sed condimentum sollicitudin turpis a aliquam. Phasellus sollicitudin quam eget ante consequat, sed pharetra purus tempor. Morbi sit amet elit eget nibh condimentum lobortis. Vivamus suscipit in orci eu rutrum.</p>
<p>Phasellus ante risus, ornare eu suscipit pharetra, suscipit in quam. Curabitur mauris ex, viverra quis volutpat at, scelerisque eu lectus. Maecenas elementum dignissim leo id pellentesque. Praesent ac risus in sapien dignissim imperdiet quis in dolor. Cras hendrerit enim eu velit ultricies, quis fringilla purus blandit. Aliquam vitae vestibulum elit, in suscipit enim. Pellentesque interdum urna quis vehicula cursus. Vestibulum id dui non orci pulvinar egestas ut eu leo. Aliquam nisi nunc, ornare ut faucibus non, viverra at ligula. Praesent in commodo eros, quis egestas ante. Curabitur gravida ut urna eu maximus. In et tortor vel neque convallis feugiat. Maecenas pharetra iaculis diam commodo bibendum. Cras sollicitudin consequat ultrices. Nulla erat nulla, facilisis eget convallis ac, congue et sem.</p>
</article>
/*body selector necessary on Codepen*/
*, body{
margin: 0;
padding: 0;
font-family: Old Standard TT, Times, serif;
}
* + *{ margin-top: 1rem; }
article{
max-width: 640px;
margin: 0 auto;
padding: 2rem;
}
h1{
text-transform: uppercase;
font-weight: 700;
font-size: 2.5em;
line-height: 1.5em;
}
p{
font-size: 1rem;
line-height: 1.5em;
line-height: 1.5rem;
}
p:first-child::first-letter, :not(p) + p:first-letter{ font-size: 1.5rem; }
p + p{ text-indent: 2rem;}
//fun with selectors
//thanks to Heydon Pickering at A List Apart
//http://alistapart.com/article/axiomatic-css-and-lobotomized-owls
Also see: Tab Triggers