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>
<h1>Scroll Indicator</h1>
</header>
<main>
<h2>Try scrolling down the page</h2>
<p>Idea <a href="https://codepen.io/MadeByMike/pen/ZOrEmr">by Mike</a>.</p>
<h2>Lorem ipsum dolor sit amet.</h2>
<p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Laborum, deserunt qui! Minima culpa possimus, nostrum consequatur in suscipit incidunt quas dolore qui ex deleniti nisi, voluptas exercitationem at officia tempora!</p>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Modi consequatur similique nostrum accusantium sapiente iste tempore dolorum. Sunt aliquam magni, amet necessitatibus nam, eveniet odit praesentium, deleniti veniam a perspiciatis.</p>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Et odit ea nesciunt architecto mollitia debitis laboriosam, magni laudantium cumque laborum obcaecati, explicabo voluptate deleniti nihil? Magni nisi facere expedita asperiores!</p>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Esse earum repellendus veritatis necessitatibus corrupti, debitis corporis saepe ad possimus odit quidem, sapiente recusandae odio fuga incidunt aspernatur perspiciatis similique itaque.</p>
<h2>Hic ex eaque esse in.</h2>
<p>Voluptatibus perferendis veritatis hic voluptas architecto culpa dignissimos ut a iste possimus asperiores delectus recusandae cumque voluptate aperiam cupiditate quasi, nemo facere est deserunt ipsum necessitatibus temporibus ab molestias. Vitae!</p>
<p>Obcaecati quo voluptate laborum itaque ipsam, aliquid, nihil quisquam, tempora iusto veniam rem. Impedit soluta ducimus odio error asperiores laborum sapiente numquam atque voluptatem, delectus tempora ex ratione amet obcaecati.</p>
<p>Porro possimus minus provident! Et in blanditiis necessitatibus ducimus itaque vitae, quo quos suscipit delectus minus sit neque, assumenda eius impedit totam autem porro recusandae aperiam. Minima non corrupti maxime.</p>
<p>Veniam debitis unde cumque quibusdam, maiores, eaque quia labore nihil deleniti a quidem consequuntur excepturi facilis, explicabo at neque ea tempore aspernatur asperiores. Adipisci, culpa ducimus autem rerum saepe maxime.</p>
<h2>Sunt, dolore! Voluptas, ab dolorum.</h2>
<p>Mollitia, vitae unde? Dolores aut modi neque facilis soluta sint iure unde! Omnis officia facere molestiae perspiciatis sequi cumque qui mollitia eaque iure magni, fugit veniam reiciendis cum soluta eius.</p>
<p>Culpa nihil voluptatum natus dicta dolorum quis, ex delectus sed officiis accusamus adipisci. Similique molestias excepturi quod, mollitia repellat nihil numquam quidem omnis nam consectetur animi recusandae, esse harum voluptatum?</p>
<p>Numquam consequatur amet sint odio, ad veritatis? Quia recusandae odit laudantium, porro minus delectus, maiores corrupti praesentium tempore officia optio culpa aspernatur accusamus incidunt assumenda. Reiciendis accusamus nobis sunt non?</p>
<p>Iure, repudiandae itaque? Excepturi incidunt, dicta, accusantium beatae exercitationem eos in, consequatur quibusdam cumque omnis neque animi dolorum. Velit alias sequi perferendis dolore obcaecati non impedit nemo amet voluptatibus saepe?</p>
<h2>Explicabo, aut voluptates! Suscipit, ipsam!</h2>
<p>Cumque distinctio temporibus nostrum, exercitationem libero consectetur eligendi expedita quasi veritatis quis dicta maxime soluta provident, excepturi eum unde earum repellendus? Repudiandae voluptatem est, enim dignissimos facere iste officia libero!</p>
<p>Ut recusandae accusamus voluptatem ea, tempora aut dolorem enim, ex dolore odit modi at voluptatibus aliquam quod ipsam fuga et iste similique mollitia! Doloribus tenetur sequi nam modi consectetur culpa.</p>
<p>Hic blanditiis aspernatur assumenda, modi repellat dicta, officiis error fuga est magnam dolore repudiandae laboriosam pariatur odit. Vitae inventore fugit accusantium minima, quo neque aliquam ipsum! Temporibus fugiat culpa nam.</p>
<p>Harum odio ipsa aliquam, quisquam voluptatum, exercitationem laboriosam consectetur voluptas unde, expedita alias fugiat dolorem similique enim et dignissimos perspiciatis. Sapiente, blanditiis beatae animi eos ad ullam dolorem expedita. Quae.</p>
<h2>Pariatur illo atque placeat iste.</h2>
<p>Natus animi totam est dolore eum officiis eius maiores exercitationem excepturi unde sint expedita eos esse a sit ea itaque, similique, impedit dicta, aperiam odio in. Aspernatur optio commodi blanditiis!</p>
<p>Autem provident maiores aperiam dicta placeat dolores doloribus similique minima non odit quia harum nobis, ut fuga molestiae temporibus rerum. Impedit nesciunt veritatis reprehenderit fuga iure facilis tenetur, odio veniam.</p>
<p>Suscipit fuga porro aspernatur fugit numquam itaque ullam, illo nihil earum quae odio facilis commodi laboriosam magnam, dolor similique labore sunt? Nam sunt reprehenderit ab aliquid perspiciatis, unde minima soluta!</p>
<p>Dignissimos suscipit doloribus incidunt ipsa veritatis optio? Accusantium, aliquid et quam harum nemo nesciunt doloribus! Suscipit eum expedita aliquid itaque. Et maiores, architecto tempore impedit perferendis culpa est mollitia delectus?</p>
</main>
header {
position: fixed;
top: 0;
height: 125px;
width: 100%;
background: white;
padding: 1rem 2rem;
}
main {
margin-top: 128px;
padding: 2rem;
}
body {
background: linear-gradient(to right top, #0089f2 50%, #ddd 50%);
background-size: 100% calc(100% - 100vh + 129px);
background-repeat: no-repeat;
margin: 0;
font-family: "Open Sans", sans-serif;
}
body::before {
content: "";
position: fixed;
top: 128px;
bottom: 0;
width: 100%;
z-index: -1;
background: white;
}
* {
box-sizing: border-box;
}
Also see: Tab Triggers