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.
<header>
HEADER
</header>
<div class="container">
<aside class="leftbar">
LEFTBAR
</aside>
<section class="content">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur urna elit, sodales nec pellentesque eu, blandit sit amet ipsum. Vestibulum pulvinar accumsan diam, eget blandit felis hendrerit non. Morbi ligula metus, consequat in consequat vel, rhoncus ut felis. Suspendisse viverra eu ipsum nec porttitor. Sed eu sodales elit. Morbi venenatis, sem id iaculis tempus, leo mi egestas felis, sed suscipit ligula elit non est. Mauris egestas nisi et sapien blandit, eget convallis massa ultrices.
<br><br>
Suspendisse lobortis condimentum mollis. Sed maximus ligula mauris, tincidunt maximus metus euismod ac. Pellentesque cursus mollis ipsum sed molestie. Phasellus felis justo, imperdiet eu venenatis in, pretium et turpis. Etiam venenatis elit eu pulvinar interdum. Vivamus sagittis lobortis risus sed commodo. Vestibulum pellentesque turpis at porta euismod. Interdum et malesuada fames ac ante ipsum primis in faucibus. Donec dapibus odio diam, ut pulvinar lacus pulvinar tincidunt. Nulla auctor urna non volutpat cursus. Ut ac tellus nulla. Nulla faucibus sed odio in lobortis.
<br><br>
Donec et viverra libero. Integer a sem ullamcorper, varius metus at, malesuada lectus. Integer fermentum leo mi, a placerat turpis vestibulum ac. Sed non risus quis purus posuere mattis in ut diam. Maecenas vehicula nec tortor eu mattis. Vivamus vehicula vel nisi quis mattis. Morbi vestibulum hendrerit eros quis condimentum. Etiam sed diam laoreet, vestibulum diam nec, ullamcorper lorem. Ut consequat diam vel sapien tempor porta.
<br><br>
Nullam varius lectus a odio rutrum vulputate. Vivamus pulvinar accumsan lorem at ullamcorper. In non neque finibus, aliquet leo non, faucibus quam. Sed ornare ut tellus non tempus. Etiam maximus venenatis cursus. Morbi suscipit massa sed mi varius tincidunt eu et dolor. Pellentesque eu ante nec ante ultricies laoreet ut eget nibh. Ut vel ex urna.
<br><br>
In vel nibh egestas, lacinia dui et, ultrices nulla. Duis semper turpis ut semper rhoncus. Ut tempor metus libero, a tristique felis imperdiet non. Suspendisse imperdiet, dolor sit amet vehicula lobortis, nibh libero porttitor nisi, nec pulvinar leo nisi nec felis. Aliquam porttitor vulputate suscipit. Proin arcu tortor, pellentesque eu justo ac, venenatis ultricies nunc. Cras vitae dui nisi.
<br><br>
Vestibulum vel leo non lacus laoreet convallis. Fusce molestie imperdiet sapien, sed convallis magna. Integer mattis quis augue a sodales. Duis turpis ante, pellentesque auctor erat id, sagittis finibus ante. Pellentesque fermentum, elit id ultricies elementum, est ipsum eleifend quam, sit amet mollis nibh leo ac urna. Morbi vehicula urna odio, ut egestas quam sagittis vitae. Vivamus vitae fringilla enim, facilisis rhoncus enim. Suspendisse ultrices diam sit amet nibh scelerisque, non eleifend mauris aliquet.
<br><br>
Suspendisse sed ligula et metus imperdiet consequat. Donec bibendum elit nisi, vel pharetra leo efficitur in. Proin sed justo nec orci aliquam sodales sed ac enim. Donec ornare quam nisi, eu pulvinar felis pellentesque eu. Sed vel sapien in eros rutrum congue non quis neque. Donec vel orci velit. Fusce suscipit, purus vel aliquet feugiat, tellus nibh maximus diam, ut cursus dui odio nec mi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.
<br><br>
Vestibulum fringilla sodales eros, et pretium est. Mauris hendrerit egestas lorem nec porta. Sed gravida consectetur ullamcorper. Quisque neque eros, rutrum ac convallis et, dictum convallis ante. Curabitur et lorem sagittis, pharetra nisi sollicitudin, tempus nulla. Donec nec elementum arcu. Aenean mattis vitae augue eget dictum. Proin velit urna, sagittis pretium elit nec, rhoncus suscipit turpis. Fusce auctor felis ut tortor aliquet, ut laoreet eros dignissim. Aenean eget tempus elit. Nam congue felis sit amet nisi rhoncus, vel fermentum eros luctus.
<br><br>
Morbi ullamcorper lacus ut odio varius, sit amet placerat turpis dignissim. Vivamus eget eleifend elit. Nullam mollis pellentesque pretium. Proin vitae lacus dictum, eleifend ante nec, scelerisque ex. Pellentesque eu magna tellus. Aenean venenatis quam nisi, sed auctor est tristique in. Aenean elementum sapien id urna iaculis eleifend. Mauris ut nibh varius, porttitor orci eget, egestas velit.
<br><br>
Vestibulum iaculis urna sed eleifend ullamcorper. Curabitur vitae vehicula nisi, vitae pulvinar lorem. Donec facilisis mauris et tellus ultricies hendrerit. In hac habitasse platea dictumst. Donec dapibus ornare velit, imperdiet cursus ex malesuada ut. Aenean eget dui quis mauris congue luctus. Etiam eget lectus nisl.
</section>
<aside class="rightbar">
RIGHTBAR
</aside>
</div>
<footer>
FOOTER
</footer>
* {
padding: 0;
margin: 0;
list-style: none;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
html {
height: 100%;
}
body {
height: 100%;
display: flex;
flex-direction: column;
}
header {
height: 60px;
min-height: 60px;
background: #333;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
}
.container {
display: flex;
flex: 1;
min-height: 0;
.leftbar {
width: 200px;
min-width: 200px;
background: #eee;
text-align: center;
padding: 20px;
box-sizing: border-box;
}
.content {
overflow: auto;
padding: 20px;
}
.rightbar {
box-sizing: border-box;
width: 150px;
min-width: 150px;
background: #ddd;
text-align: center;
padding: 20px;
}
}
footer {
background: #666;
height: 50px;
min-height: 50px;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
}
@media(max-width: 1000px){
body {
display: block;
}
.container {
flex-wrap: wrap;
flex-grow: 0;
.leftbar, .rightbar {
flex: 1 1 auto;
order: 2;
}
.content {
order: 1;
}
}
footer {
order: 3;
}
}
@media(max-width: 700px){
.container {
.lefbar, .rightbar {
width: 100%;
}
}
}
Also see: Tab Triggers