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.
<article>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Reiciendis ea animi sequi nisi nostrum voluptates voluptate velit ut, nobis ipsa doloremque neque, quod exercitationem, veniam consequuntur ratione ullam reprehenderit ex!</p>
<p>Aliquid ad obcaecati laudantium consectetur architecto officiis ab voluptates consequuntur temporibus aspernatur placeat deserunt, quod nulla esse soluta similique? Eaque autem itaque, animi non ut tempore provident suscipit eligendi dolor?</p>
<p>Eveniet velit illum dicta deserunt temporibus ducimus vel totam vitae nisi tenetur. Vero odio dolore eum, voluptatum sed reiciendis, assumenda placeat quod totam atque reprehenderit porro non est vel rem.</p>
<figure>
<figcaption>
<strong>Highway</strong>
Blues
</figcaption>
<img src='https://images.unsplash.com/photo-1524650359799-842906ca1c06?ixlib=rb-1.2.1&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ' alt='Woman holding guitar over shoulder'>
<img src="https://res.cloudinary.com/css-tricks/image/upload/q_auto/v1580427660/guitar-woman_pfqzvc.png" alt="" class="top">
</figure>
<p>Reiciendis, aut pariatur enim ea molestias fugiat suscipit cumque asperiores cum animi sunt, ullam mollitia nobis numquam. Cumque veniam facere ipsa, deleniti fugiat iusto, doloribus ut obcaecati doloremque nihil quo.</p>
<p>Quidem, nulla cupiditate pariatur, corrupti aperiam provident doloribus commodi laboriosam blanditiis cumque odit incidunt repudiandae ab minus aliquid possimus perferendis. Totam ipsa sequi ullam architecto quia, officia minima voluptatem eaque?</p>
<p>Consequuntur facilis nobis velit est neque quis incidunt esse porro cupiditate in praesentium sunt magnam temporibus nesciunt, deleniti eaque dolores iure sed harum adipisci. Reiciendis enim rerum at nostrum esse.</p>
<p>Aspernatur perferendis ducimus quasi magnam a, voluptatum nemo inventore quibusdam molestias earum, saepe accusamus repellendus beatae. Natus laboriosam in explicabo eius suscipit dolores a itaque perspiciatis corporis praesentium! Sapiente, iste.</p>
<p>Voluptatem quo aliquid accusantium, voluptates officia error incidunt illo, eius itaque ad tempora deserunt iusto pariatur perspiciatis repudiandae a, natus vero provident repellendus. Aperiam odit, adipisci magnam voluptatibus omnis eum!</p>
<p>Ratione unde similique laborum nemo facere amet, aliquid tempora eaque placeat itaque illum rem quam neque delectus labore, perspiciatis iste minus fugiat accusantium voluptatum saepe? Nulla excepturi et dignissimos saepe?</p>
<p>Quo qui at nesciunt numquam laboriosam iure ullam vitae tempora expedita neque et ea, doloremque excepturi eaque aspernatur quod autem veniam? Ipsum porro quidem facere. Sint debitis facere dolor in.</p>
</article>
article {
max-width: 500px;
margin: 2rem auto;
font: 1.5rem/1.5 system-ui;
}
figure {
padding: 0;
margin: 0;
position: relative;
img {
max-width: 100%;
display: block;
}
img.top {
position: absolute;
left: 0;
bottom: 0;
}
figcaption {
border: 5px solid #009688;
color: #009688;
text-transform: uppercase;
font-size: 3rem;
line-height: 1;
padding: 0.25rem;
text-align: center;
position: sticky;
top: 0;
mix-blend-mode: color-dodge;
strong {
display: block;
}
}
}
body {
background: red;
}
Also see: Tab Triggers