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 URL's 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 it's URL and the proper URL extention.
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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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.
<div asscroll-container>
<div class="page">
<div id="top"></div>
<img src="https://raw.githubusercontent.com/ashthornton-gc/asscroll/master/docs/banner.jpg" alt="">
<div class="content">
<h1 class="title">
<span>A</span>
<span>S</span>
<span>S</span>
<span>C</span>
<span>R</span>
<span>O</span>
<span>L</span>
<span>L</span>
<span>🍑</span>
</h1>
<div>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam ornare quis nibh eget convallis. Nam aliquam tempus dolor, at blandit elit vulputate eu. Mauris iaculis sem at nulla euismod auctor. Duis dui risus, lacinia quis fringilla a, dictum a lectus. Aliquam id dui a nisi dignissim aliquet nec sed augue. Vestibulum congue felis sit amet iaculis scelerisque. Vivamus facilisis lacus sit amet eros eleifend dapibus in eget neque. Aliquam nisi urna, porttitor et nisi in, pretium lacinia orci. Cras vitae leo posuere, condimentum magna et, vulputate mi. Nullam maximus ullamcorper leo eu auctor. Quisque eget fermentum est, aliquet cursus libero. Sed scelerisque mauris sed enim tristique tempus ornare vestibulum quam. Etiam eget aliquam augue. In nec lectus convallis, lobortis risus in, euismod lorem. Sed eleifend nisi ut lorem convallis, nec blandit ante egestas.</p>
<p>Quisque quis tincidunt nunc. In magna est, malesuada quis tempus id, fermentum eleifend urna. Fusce facilisis rhoncus nibh, eget pellentesque mauris rhoncus ut. Nulla congue vel lacus nec pellentesque. Praesent eget elit nisi. Ut eu enim arcu. Duis et nisi ligula. Maecenas eu ante eget augue pulvinar efficitur. Aenean vitae luctus dolor. Ut iaculis orci ut orci tincidunt, id efficitur nulla accumsan. Nullam feugiat porta hendrerit. Pellentesque eget fringilla leo. Quisque laoreet ligula quis consectetur aliquam.</p>
<p>Nam vel auctor nisl. Cras vel suscipit nibh. Donec nec massa sagittis, vehicula magna ac, scelerisque velit. Etiam mollis felis orci, id placerat ipsum egestas a. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Aenean faucibus vulputate feugiat. Nam condimentum arcu urna, id tincidunt nisl rhoncus quis. Duis mauris mi, dapibus et nisl at, facilisis tristique lectus. Nam vel felis in metus hendrerit placerat ac quis massa. Nam eget turpis nunc. Nullam at tincidunt lacus. Nulla viverra magna in nisi semper, non interdum nunc tempus. In pellentesque porttitor bibendum. Vestibulum blandit congue tempor.</p>
<p>Cras congue, nunc et imperdiet porttitor, dui nisl ultricies ipsum, sed bibendum neque leo auctor sem. Nam velit ipsum, dictum eget dolor pellentesque, pulvinar imperdiet purus. Quisque leo dui, eleifend non porttitor quis, auctor convallis tortor. Integer vel justo at odio suscipit gravida vitae ut tellus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris sapien urna, iaculis quis magna at, facilisis ultrices elit. Maecenas ac elementum metus, sit amet congue nunc. Maecenas vitae posuere lectus. Integer maximus neque at nunc vestibulum imperdiet. Aenean imperdiet ligula semper nibh dapibus facilisis. Pellentesque gravida dignissim lacus, et vulputate sapien dapibus commodo. Etiam efficitur facilisis sollicitudin. Quisque velit nulla, condimentum ac tellus eget, rutrum placerat ipsum. Cras auctor auctor sem sed ullamcorper.</p>
<h3>iframe:</h3>
<iframe src="https://cdpn.io/ashthornton/debug/ff7efd49451e9faf9416eb989bfaac8c" frameborder="0"></iframe>
<p>Quisque quis tincidunt nunc. In magna est, malesuada quis tempus id, fermentum eleifend urna. Fusce facilisis rhoncus nibh, eget pellentesque mauris rhoncus ut. Nulla congue vel lacus nec pellentesque. Praesent eget elit nisi. Ut eu enim arcu. Duis et nisi ligula. Maecenas eu ante eget augue pulvinar efficitur. Aenean vitae luctus dolor. Ut iaculis orci ut orci tincidunt, id efficitur nulla accumsan. Nullam feugiat porta hendrerit. Pellentesque eget fringilla leo. Quisque laoreet ligula quis consectetur aliquam.</p>
<p>Nam vel auctor nisl. Cras vel suscipit nibh. Donec nec massa sagittis, vehicula magna ac, scelerisque velit. Etiam mollis felis orci, id placerat ipsum egestas a. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Aenean faucibus vulputate feugiat. Nam condimentum arcu urna, id tincidunt nisl rhoncus quis. Duis mauris mi, dapibus et nisl at, facilisis tristique lectus. Nam vel felis in metus hendrerit placerat ac quis massa. Nam eget turpis nunc. Nullam at tincidunt lacus. Nulla viverra magna in nisi semper, non interdum nunc tempus. In pellentesque porttitor bibendum. Vestibulum blandit congue tempor.</p>
<p>Aenean sit amet convallis nulla, vel egestas odio. Phasellus molestie mauris enim, ut vestibulum ipsum consequat in. Praesent aliquet posuere porttitor. Integer congue nibh eu massa sagittis pulvinar sit amet vitae libero. Sed iaculis diam ligula, at finibus sapien congue ut. Integer euismod, mauris ut pretium feugiat, massa est commodo erat, et vulputate ex neque in neque. In id pharetra orci, vel feugiat ipsum.</p>
</div>
</div>
<p><a href="#top">Back to top</a></p>
</div>
</div>
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;600&display=swap');
.page {
width: 100%;
max-width: 700px;
margin: auto;
padding: 2rem 0;
font-family: 'Open Sans', sans-serif;
font-weight: 300;
}
img {
display: block;
width: 100%;
}
.content {
display: flex;
margin: 2rem 0;
p:last-child {
margin: 0;
}
}
.title {
display: flex;
flex-direction: column;
justify-content: space-between;
font-size: 4vw;
font-weight: 600;
margin: 0 1rem 0 0;
color: #ccc7bd;
span:last-child {
font-size: 2vw;
}
}
iframe {
width: 100%;
height: 300px;
box-shadow: 0px 0px 20px rgb(0 0 0 / 6%);
}
import ASScroll from 'https://cdn.skypack.dev/@ashthornton/asscroll'
// https://github.com/ashthornton/asscroll
const asscroll = new ASScroll()
window.addEventListener('load', () => {
asscroll.enable()
})
Also see: Tab Triggers