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 class="title">Lorem ipsum dolor sit amet</h1>
<div class="content-wrapper">
<nav class="left-nav">
<ul class="left-nav__list">
<li class="left-nav__list-item"><a href="#" class="left-nav__link">Lorem ipsum dolor.</a></li>
<li class="left-nav__list-item"><a href="#" class="left-nav__link">Non, officiis iusto.</a></li>
<li class="left-nav__list-item"><a href="#" class="left-nav__link">Sed, velit, ullam?</a></li>
<li class="left-nav__list-item"><a href="#" class="left-nav__link">Nobis itaque, ad!</a></li>
<li class="left-nav__list-item"><a href="#" class="left-nav__link">Explicabo provident, sit.</a></li>
<li class="left-nav__list-item"><a href="#" class="left-nav__link">Modi, cum, nam!</a></li>
<li class="left-nav__list-item"><a href="#" class="left-nav__link">Tempora, quo illum?</a></li>
<li class="left-nav__list-item"><a href="#" class="left-nav__link">Dolore, harum, quidem!</a></li>
</ul>
</nav>
<div class="reading-column">
<h1 class="title">Lorem ipsum dolor sit amet</h1>
<div class="reading-column__section">
<h2 class="reading-column__title">Lorem ipsum dolor sit amet, consectetur.</h2>
<p class="reading-column__desc">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eius est tenetur possimus ipsum. Nostrum nobis odit delectus et excepturi, quis repudiandae facere, expedita dignissimos, quo nihil? Veritatis, voluptates expedita corporis earum esse illo ipsa vitae ab. Molestiae officiis officia aut? Explicabo earum quis officia quo eligendi eveniet reprehenderit sint dolores?</p>
</div>
<div class="reading-column__section">
<h2 class="reading-column__title">Nostrum reprehenderit nam, reiciendis explicabo suscipit!</h2>
<p class="reading-column__desc">Deserunt nesciunt qui illo corporis maxime, impedit veritatis blanditiis magni dolor! Commodi aliquam deserunt neque dicta sequi veniam quia molestias non earum illum, mollitia qui modi doloribus accusantium, explicabo, hic possimus eos dolore dignissimos repellendus similique facilis fuga fugit? Eum earum eaque enim, laboriosam culpa nemo perspiciatis alias veniam quasi?</p>
</div>
<div class="reading-column__section">
<h2 class="reading-column__title">Ipsa nihil ullam, in velit nesciunt.</h2>
<p class="reading-column__desc">Earum rerum, exercitationem. Aut numquam unde magnam accusantium praesentium nisi quae ipsum similique consequatur magni debitis, tenetur incidunt beatae explicabo fuga doloremque quisquam consectetur, necessitatibus. Quibusdam quos corrupti veniam repudiandae aut sunt quo officiis ab nam iusto temporibus ipsum laboriosam omnis, aperiam ad, quod harum facilis facere mollitia recusandae eveniet!</p>
</div>
<div class="reading-column__section">
<h2 class="reading-column__title">Quas ducimus quod, nisi iste. Labore.</h2>
<p class="reading-column__desc">Est quo vero perspiciatis explicabo ab suscipit, tempora dignissimos. Quae modi molestias, velit accusamus perspiciatis vero quia blanditiis! Ullam qui vel soluta perferendis necessitatibus odio esse labore quos sint officiis cum debitis provident voluptas incidunt, doloremque accusantium distinctio praesentium error voluptatibus amet fugiat. Expedita, molestiae, vel. Suscipit debitis, minima laborum?</p>
</div>
<div class="reading-column__section">
<h2 class="reading-column__title">Ipsa quae voluptas, deleniti commodi in!</h2>
<p class="reading-column__desc">Reiciendis temporibus nostrum voluptatum quas recusandae neque alias rerum provident asperiores optio dolore laboriosam eaque, quos doloribus perferendis nisi nesciunt, sint ducimus sit quasi pariatur ratione. Pariatur nam laboriosam debitis eligendi officia, consequuntur, deserunt ullam, illum earum quo, vel sit modi harum velit et! Quis, atque qui. Rerum, dolor, inventore!</p>
</div>
<div class="reading-column__section">
<h2 class="reading-column__title">Libero similique quas rerum quia autem.</h2>
<p class="reading-column__desc">Necessitatibus, animi, sequi. Iure officia architecto ullam quia pariatur accusamus quae repellendus accusantium id ducimus minima, necessitatibus voluptas dignissimos a praesentium, odit cum. Sint nobis, natus esse quam nam ea enim magni nulla! Doloribus ducimus, aliquam voluptatibus ad excepturi, minus, vitae nostrum maiores iure suscipit impedit. Quae labore, aliquam deserunt?</p>
</div>
<div class="reading-column__section">
<h2 class="reading-column__title">Laboriosam illum deleniti saepe ducimus ullam.</h2>
<p class="reading-column__desc">Dignissimos omnis accusamus excepturi molestias iusto totam vero corporis aliquid consequuntur. Nobis voluptates quidem, magni. Ratione dolorum nihil quod commodi officia quisquam quis dolores. Unde, corporis, voluptas! Earum ab placeat incidunt quae, iste nulla molestiae, ipsa est officia soluta inventore commodi eveniet repudiandae exercitationem debitis aliquid, minima libero asperiores repellat.</p>
</div>
<div class="reading-column__section">
<h2 class="reading-column__title">Non, ipsam eligendi saepe molestiae praesentium!</h2>
<p class="reading-column__desc">Ullam beatae nobis facilis, hic atque. Culpa soluta in iure accusantium consequuntur minima illo qui eligendi reprehenderit non labore earum et alias recusandae consectetur enim aut fuga vero aperiam cupiditate voluptates iste perspiciatis, blanditiis. Obcaecati minima dolore laudantium provident! Praesentium hic tempora laudantium nobis molestias eligendi corporis veniam delectus ut.</p>
</div>
<div class="reading-column__section">
<h2 class="reading-column__title">Voluptatum eum saepe commodi ad ea.</h2>
<p class="reading-column__desc">Necessitatibus dolore iste neque voluptates, aspernatur magni! Eos quam neque, laboriosam quas excepturi recusandae eius iusto repudiandae eveniet blanditiis saepe ratione quibusdam obcaecati animi ad voluptate sunt fugit aut eum facere sequi perspiciatis iure numquam dolorum voluptatum! Facilis error minus temporibus quis, cumque incidunt? Repudiandae odit, optio consequatur excepturi inventore!</p>
</div>
<div class="reading-column__section">
<h2 class="reading-column__title">Repudiandae quos nemo est assumenda molestiae!</h2>
<p class="reading-column__desc">Consequuntur deserunt quod dicta ipsa cumque fugiat asperiores perferendis nesciunt officiis dolorum mollitia, repellendus dolore quasi optio provident, quia ut sunt a velit fuga aliquid aut ducimus culpa! Porro assumenda quis, delectus quaerat dolores sint officia, minus labore quisquam vel deleniti, itaque placeat repudiandae at neque perferendis voluptatem quas quibusdam.</p>
</div>
</div>
</div>
// * {
// box-sizing: border-box;
// }
body {
font-family: sans-serif;
// font-size: 1.2rem;
line-height: 1.5;
margin: 2rem;
}
// img {
// width: 100%;
// }
.content-wrapper {
display: flex;
}
.title {
display: none;
}
.reading-column {
flex: 1;
}
.reading-column__section {
max-width: 60ch;
}
.reading-column .title {
display: block;
}
.left-nav {
max-width: 100%;
flex-basis: 250px;
margin-right: 2rem;
margin-top: 5rem;
text-align: right;
position: relative;
}
.left-nav__list {
padding: 0;
position: sticky;
top: 0;
}
.left-nav__list-item {
list-style-type: none;
}
@media only screen and (max-width: 900px) {
.content-wrapper {
flex-direction: column;
}
.left-nav {
flex-basis: auto;
margin-right: 0;
margin-top: 0;
text-align: left;
}
.title {
display: block;
}
.reading-column .title {
display: none;
}
}
Also see: Tab Triggers