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.
.grid
header.headline
h1 Lorem ipsum dolor sit amet consectetur adipisicing elit
.byline
h2 by Lorem Ipsum
article.article
p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsum eos explicabo distinctio maxime voluptatem impedit quis ratione laudantium, quas obcaecati sunt repudiandae numquam labore facere quidem totam ut ea qui! Corporis repudiandae iure, at, eligendi labore provident deserunt vero facere totam ipsum, aspernatur incidunt dolorum qui. Sint praesentium similique suscipit aliquid nemo voluptatibus architecto totam mollitia veniam est. Molestiae, accusamus commodi veniam magnam reiciendis modi voluptatibus explicabo, nemo repellat blanditiis corporis officiis corrupti, tenetur ea, ipsam voluptatum sed dolores ut.
p Velit non quam quia iusto cupiditate quo maiores magnam facilis expedita dolore, quibusdam, assumenda dolor harum, accusantium possimus tenetur quasi dolorem cum deleniti ab eos. Architecto, praesentium, aliquam illo ea assumenda vel numquam pariatur eos voluptas fugit sapiente, ratione! Eveniet dicta fugit corporis vel officia nostrum, fugiat laboriosam soluta harum quia quis voluptatum error deleniti aliquam ratione, quasi magnam, qui. Dolor dolore, sint dolorem quia accusantium, velit repellendus eaque delectus vel itaque unde dicta minima ex.
p Illum harum voluptatem, nulla distinctio vitae officia labore eius quibusdam? Eligendi iusto assumenda eaque magnam, tempora odit, pariatur distinctio, vitae, natus a dolore inventore. Quibusdam dolore provident veritatis iste voluptas repellendus et, quidem commodi. Eligendi soluta ratione harum asperiores nisi doloremque enim provident rem animi fugit molestias, deserunt ducimus culpa, fugiat eum quam sequi recusandae amet optio minima sunt. Expedita a facere at consectetur cum molestiae quasi, in, dicta ratione, vero, unde similique dolor neque! Omnis quasi commodi error, sequi dolorum perspiciatis blanditiis eligendi rerum est vitae consequatur consectetur quia laboriosam velit ratione odit atque ullam facere tenetur animi reprehenderit necessitatibus iusto quidem facilis! Quod provident rem, doloremque, quia suscipit voluptates non possimus eligendi molestias libero error!
p Dolore dolores adipisci incidunt, vero debitis expedita minima ratione ipsum sit voluptate animi itaque veritatis qui distinctio enim velit ad iste error suscipit nihil ex odit. Nobis eum pariatur recusandae in sint voluptas nesciunt, architecto eveniet aspernatur, sed assumenda nemo deserunt dolore illo natus expedita magnam magni! Asperiores incidunt, consequuntur minus ex facere officiis magnam pariatur, voluptatum vel dolorem adipisci quisquam perferendis reprehenderit repellat similique eligendi expedita nobis explicabo laborum molestiae vero modi. Perspiciatis deserunt dicta quaerat hic quis fuga libero enim labore, at voluptate quos nam dignissimos, cupiditate excepturi, sint molestias maiores, consectetur. A facilis corporis dicta, possimus dolor sit sequi unde. Dolore esse a dolorem! Inventore iure ex rem dignissimos fugit mollitia aliquid omnis expedita, quis est et, nisi vel placeat aspernatur, ut magnam? Nulla!
body
margin: 0
font-family: 'Gentium Book Basic', serif
background: #f9f9f9
.grid
padding: 1rem
@media (min-width: 650px)
.grid
display: grid
grid-template-columns: repeat(12, 1fr)
grid-gap: 1rem
padding: 0
.headline
grid-row: 1
grid-column: 2 / span 10
h1
font-size: 2.5rem
margin-bottom: 2rem
line-height: 1
text-transform: capitalize
@media (min-width: 400px)
h1
font-size: 3.5rem
@media (min-width: 650px)
h1
font-size: 5.5rem
.byline
grid-row: 2
grid-column: 10 / span 3
h2
font-weight: 400
font-style: italic
font-size: 1rem
margin-top: 0
margin-bottom: 2rem
text-transform: uppercase
@media (min-width: 400px)
h2
font-size: 1.2rem
.article
grid-row: 3
grid-column: 2 / span 10
columns: 3
column-width: 250px
column-gap: 1.5rem
margin-bottom: 2rem
p
font-size: 1.2rem
line-height: 1.4
color: #444
&:first-child
margin-top: 0
Also see: Tab Triggers