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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.
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.
If the stylesheet 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 CSS 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.
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.
<ons-page id="main">
<ons-toolbar>
<div class="center">My app</div>
</ons-toolbar>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed in vehicula mauris, ac auctor ligula. Quisque pellentesque, mi nec porta iaculis, massa mi varius massa, sit amet vehicula risus nisl vel felis. Praesent iaculis, nibh eu volutpat porttitor, est mauris porta risus, euismod suscipit augue urna sit amet dolor. Praesent et felis hendrerit justo ornare sodales. Proin at viverra justo. Praesent accumsan, felis et mollis pellentesque, neque quam sagittis metus, ac porta dolor metus in ex. Quisque lacus est, aliquam nec bibendum id, pulvinar nec mauris. Ut mattis varius sapien, ut ultrices ex tristique sit amet. Mauris id diam auctor, gravida arcu vitae, interdum risus. Morbi purus eros, ornare vitae semper at, tincidunt sit amet libero. Nullam quis justo in enim imperdiet sagittis. Quisque scelerisque, risus et finibus dignissim, tellus arcu auctor sapien, at fringilla tortor mauris eu justo. Nullam dui magna, condimentum et urna sed, hendrerit ultrices magna. Mauris at neque pharetra, volutpat enim id, vehicula justo. Mauris ac magna posuere, vehicula sem ut, ultricies velit. Nullam facilisis erat ut auctor vulputate.
Nullam dapibus tempus diam condimentum eleifend. Aenean lobortis sit amet quam egestas fermentum. Donec convallis, magna eget tempus bibendum, tellus odio facilisis dolor, at fermentum est leo a tortor. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Curabitur nec arcu augue. Maecenas eu scelerisque ex, sit amet tincidunt felis. Donec in gravida nibh.
Mauris justo odio, fermentum vel lacinia ac, tincidunt in sapien. Ut vehicula malesuada varius. Aenean dignissim, eros in placerat accumsan, metus erat elementum sapien, ut interdum sem orci vitae elit. Maecenas eu purus a arcu convallis convallis nec non enim. Aenean vel malesuada sapien, in maximus nibh. Nulla facilisi. Proin sodales dapibus enim, sed venenatis risus sagittis ut. Sed gravida enim nulla. Nulla ultricies imperdiet ligula in ullamcorper. Suspendisse congue vehicula quam, ut ultrices diam. Aenean lectus tortor, lobortis interdum sem id, ullamcorper ultricies eros. Aenean vel nisi non est faucibus dignissim ac ut urna.
Vestibulum lobortis orci eget volutpat fermentum. Integer hendrerit volutpat lectus, nec elementum ligula condimentum in. Sed ultricies nisi at ultrices aliquet. Sed sed tempor leo, eu porttitor augue. Duis felis neque, aliquam non imperdiet ac, auctor suscipit neque. Sed euismod arcu pretium, lacinia felis a, fermentum leo. Vivamus a erat ac turpis consequat tempor non id tellus. Donec faucibus eros sed velit luctus tristique. Nunc fringilla risus non ante venenatis, sed laoreet ex auctor. Nulla est nibh, lacinia quis metus sit amet, efficitur porttitor mi. Praesent diam dolor, ultricies et vestibulum et, vehicula in purus. Curabitur accumsan sed sem quis iaculis. Nunc cursus eu nulla sit amet gravida. Interdum et malesuada fames ac ante ipsum primis in faucibus. Donec nec egestas tortor.
Proin ultrices ut nisl a rhoncus. Maecenas molestie dui nec ornare mattis. Sed blandit orci eget fringilla efficitur. Vestibulum et sagittis felis. Curabitur quis justo et dui tempus scelerisque. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Phasellus sodales tristique suscipit. Cras mauris odio, laoreet aliquet massa eget, mollis ultricies sem. Phasellus quis metus fermentum enim consequat dignissim. Vivamus justo nisl, aliquam non nunc id, mollis convallis enim. Maecenas auctor velit turpis, eget tempor sapien placerat ut. Maecenas volutpat tristique nisl at interdum. Etiam nec mauris a erat pellentesque placerat vel vel velit. Etiam sed ipsum vestibulum, rhoncus ipsum id, rhoncus metus.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed in vehicula mauris, ac auctor ligula. Quisque pellentesque, mi nec porta iaculis, massa mi varius massa, sit amet vehicula risus nisl vel felis. Praesent iaculis, nibh eu volutpat porttitor, est mauris porta risus, euismod suscipit augue urna sit amet dolor. Praesent et felis hendrerit justo ornare sodales. Proin at viverra justo. Praesent accumsan, felis et mollis pellentesque, neque quam sagittis metus, ac porta dolor metus in ex. Quisque lacus est, aliquam nec bibendum id, pulvinar nec mauris. Ut mattis varius sapien, ut ultrices ex tristique sit amet. Mauris id diam auctor, gravida arcu vitae, interdum risus. Morbi purus eros, ornare vitae semper at, tincidunt sit amet libero. Nullam quis justo in enim imperdiet sagittis. Quisque scelerisque, risus et finibus dignissim, tellus arcu auctor sapien, at fringilla tortor mauris eu justo. Nullam dui magna, condimentum et urna sed, hendrerit ultrices magna. Mauris at neque pharetra, volutpat enim id, vehicula justo. Mauris ac magna posuere, vehicula sem ut, ultricies velit. Nullam facilisis erat ut auctor vulputate.
Nullam dapibus tempus diam condimentum eleifend. Aenean lobortis sit amet quam egestas fermentum. Donec convallis, magna eget tempus bibendum, tellus odio facilisis dolor, at fermentum est leo a tortor. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Curabitur nec arcu augue. Maecenas eu scelerisque ex, sit amet tincidunt felis. Donec in gravida nibh.
Mauris justo odio, fermentum vel lacinia ac, tincidunt in sapien. Ut vehicula malesuada varius. Aenean dignissim, eros in placerat accumsan, metus erat elementum sapien, ut interdum sem orci vitae elit. Maecenas eu purus a arcu convallis convallis nec non enim. Aenean vel malesuada sapien, in maximus nibh. Nulla facilisi. Proin sodales dapibus enim, sed venenatis risus sagittis ut. Sed gravida enim nulla. Nulla ultricies imperdiet ligula in ullamcorper. Suspendisse congue vehicula quam, ut ultrices diam. Aenean lectus tortor, lobortis interdum sem id, ullamcorper ultricies eros. Aenean vel nisi non est faucibus dignissim ac ut urna.
Vestibulum lobortis orci eget volutpat fermentum. Integer hendrerit volutpat lectus, nec elementum ligula condimentum in. Sed ultricies nisi at ultrices aliquet. Sed sed tempor leo, eu porttitor augue. Duis felis neque, aliquam non imperdiet ac, auctor suscipit neque. Sed euismod arcu pretium, lacinia felis a, fermentum leo. Vivamus a erat ac turpis consequat tempor non id tellus. Donec faucibus eros sed velit luctus tristique. Nunc fringilla risus non ante venenatis, sed laoreet ex auctor. Nulla est nibh, lacinia quis metus sit amet, efficitur porttitor mi. Praesent diam dolor, ultricies et vestibulum et, vehicula in purus. Curabitur accumsan sed sem quis iaculis. Nunc cursus eu nulla sit amet gravida. Interdum et malesuada fames ac ante ipsum primis in faucibus. Donec nec egestas tortor.
Proin ultrices ut nisl a rhoncus. Maecenas molestie dui nec ornare mattis. Sed blandit orci eget fringilla efficitur. Vestibulum et sagittis felis. Curabitur quis justo et dui tempus scelerisque. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Phasellus sodales tristique suscipit. Cras mauris odio, laoreet aliquet massa eget, mollis ultricies sem. Phasellus quis metus fermentum enim consequat dignissim. Vivamus justo nisl, aliquam non nunc id, mollis convallis enim. Maecenas auctor velit turpis, eget tempor sapien placerat ut. Maecenas volutpat tristique nisl at interdum. Etiam nec mauris a erat pellentesque placerat vel vel velit. Etiam sed ipsum vestibulum, rhoncus ipsum id, rhoncus metus.
</p>
</ons-page>
#main .page__content {
top: 0;
padding-top: 44px;
}
#main .navigation-bar {
opacity: 1;
transform: translate3d(0,0,0);
transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}
#main.hidden-bar .navigation-bar {
opacity: 0;
transform: translate3d(0, -44px, 0);
}
/* Android Material Design */
#main.hidden-bar .navigation-bar--material {
opacity: 0;
transform: translate3d(0, -56px, 0);
}
#main .navigation-bar--material + .page__background + .page__content {
padding-top: 56px;
}
document.addEventListener('init', function(e) {
var scrollValue = 0;
var page = e.target;
page.querySelector('.page__content').addEventListener('scroll', function (e) {
var delta = this.scrollTop - scrollValue;1;
if (Math.abs(delta) > 8) {
console.log(delta, scrollValue);
page.classList.toggle('hidden-bar', delta > 0 && scrollValue > 36)
scrollValue = this.scrollTop;
}
});
})
Also see: Tab Triggers