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.
<div class="mb-5 text-muted">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eu ipsum finibus, rhoncus nisl vitae, tincidunt mauris. Curabitur sagittis aliquet leo, nec porttitor enim auctor ut. Donec in eros ac mi efficitur gravida id nec erat. Aliquam ultrices eros a mauris accumsan, ut elementum odio congue. Sed et pulvinar risus. Morbi vitae dolor consequat orci pellentesque iaculis. Nullam laoreet maximus sem, in
</div>
<div class="mb-5" id="app">
<p class="alert alert-primary">Use mousewheel to scroll the tabs while preventing vertical page scroll</p>
<!-- Nav tabs -->
<ul class="nav nav-pills flex-nowrap" id="myTab" role="tablist">
<li class="nav-item" role="presentation">
<a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">Home</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="profile" aria-selected="false">Profile</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="messages-tab" data-toggle="tab" href="#messages" role="tab" aria-controls="messages" aria-selected="false">Messages</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="settings-tab" data-toggle="tab" href="#settings" role="tab" aria-controls="settings" aria-selected="false">Settings</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="settings-tab" data-toggle="tab" href="#settings" role="tab" aria-controls="settings" aria-selected="false">Settings</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="settings-tab" data-toggle="tab" href="#settings" role="tab" aria-controls="settings" aria-selected="false">Settings</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="settings-tab" data-toggle="tab" href="#settings" role="tab" aria-controls="settings" aria-selected="false">Settings</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="settings-tab" data-toggle="tab" href="#settings" role="tab" aria-controls="settings" aria-selected="false">Settings</a>
</li>
</ul>
<!-- Tab panes -->
<div class="tab-content py-3">
<div class="tab-pane active" id="home" role="tabpanel" aria-labelledby="home-tab">
Ut laoreet, tellus ornare suscipit pharetra, dolor nisl fringilla ligula, id eleifend leo sapien sit amet enim. Nunc volutpat fermentum nunc, vitae laoreet ligula aliquet nec. Vivamus ullamcorper eget nulla mattis fermentum. Duis iaculis bibendum risus non imperdiet. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras ullamcorper enim elit, ac interdum eros facilisis feugiat. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
</div>
<div class="tab-pane" id="profile" role="tabpanel" aria-labelledby="profile-tab">2</div>
<div class="tab-pane" id="messages" role="tabpanel" aria-labelledby="messages-tab">3</div>
<div class="tab-pane" id="settings" role="tabpanel" aria-labelledby="settings-tab">4</div>
</div>
</div>
<p class="text-muted">
Vivamus suscipit at purus sed aliquet. Praesent gravida lectus eget enim varius scelerisque. Maecenas faucibus, neque nec consequat mollis, sapien libero pellentesque elit, et iaculis dui lorem ut dolor. Duis a leo in est consectetur vestibulum accumsan ac nunc. Vestibulum lectus eros, commodo a metus nec, sollicitudin mollis lectus. Maecenas et sapien eu nunc tempor egestas quis eget diam. Aliquam venenatis nulla eget aliquet posuere. Quisque efficitur non mauris ut sollicitudin.
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Curabitur a tristique diam. Donec rhoncus ante lorem, non dapibus erat iaculis vehicula. Phasellus justo turpis, consectetur in nisi eget, tincidunt dictum mi. Donec venenatis nunc eget felis tempor lacinia. Pellentesque a tincidunt leo. In tincidunt ligula eu efficitur sagittis. Aenean convallis sit amet arcu non dapibus.
Maecenas lobortis dignissim dignissim. Donec sollicitudin lorem ex. Integer non sem lobortis, rutrum orci finibus, condimentum elit. Phasellus ac felis eu arcu pretium finibus. Nulla vestibulum, odio sed imperdiet aliquet, est nulla sodales urna, lacinia facilisis turpis arcu in erat. Aliquam eu condimentum nulla, ut ultricies arcu. Duis vel ultricies enim. Ut in cursus elit. Sed tincidunt ac lectus in feugiat. Maecenas sit amet varius metus.
Nullam varius posuere nibh, vel faucibus est tristique et. Nam luctus velit nec lorem dictum ultrices. Donec fermentum nunc at nisl pulvinar, vel aliquam ligula rutrum. Integer euismod eu enim at consectetur. Phasellus vestibulum odio ante, id pharetra elit scelerisque et. Cras neque quam, rutrum quis semper nec, luctus et erat. Ut eget ipsum in orci pretium pulvinar.
Vestibulum euismod facilisis turpis, nec tincidunt ex. Aliquam lacinia blandit placerat. Cras quis vehicula nibh. Proin bibendum nisi at elementum accumsan. Maecenas sodales faucibus enim, et vulputate diam viverra sed. Phasellus congue placerat orci, eu imperdiet augue ultricies sit amet. Morbi ligula sapien, porta nec est a, venenatis bibendum nulla. Etiam efficitur tellus vitae diam bibendum posuere.
Morbi a nulla lectus. Vestibulum tellus lorem, feugiat id rutrum a, fermentum eget risus. Nunc convallis ac ipsum vel tincidunt. Proin maximus, arcu imperdiet luctus viverra, velit lectus porttitor ante, vel bibendum odio felis vitae orci. Mauris vel dui sit amet lectus vehicula pulvinar. Morbi efficitur venenatis pretium. Duis sed magna id diam posuere tincidunt. Nunc ac turpis a diam pretium luctus. Phasellus placerat felis ipsum, id pretium odio hendrerit at. Vestibulum interdum, purus non fermentum pellentesque, neque velit rhoncus justo, eget mattis augue nisi rutrum erat. Suspendisse ac ligula eleifend, facilisis purus eu, convallis risus. Vivamus scelerisque augue orci, a aliquam urna sollicitudin a. Aliquam consectetur porta velit, id pharetra arcu porta eget. Interdum et malesuada fames ac ante ipsum primis in faucibus. Morbi urna ligula, volutpat id nisi molestie, laoreet vestibulum nunc. Morbi sem lacus, posuere id suscipit sit amet, mollis quis orci.</p>
.nav{
&::after{
content: ' ';
display: block;
background-color: #fff;
background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 26%);
width: 50px;
position: sticky;
right: 0;
bottom: 0;
top: 0;
left: 20px;
min-width: 61px; /* important */
}
--scrollbarBG: transparent;
--thumbBG: #eee;
&:hover{
--thumbBG: #e0e0e0;
}
position: relative;
overflow-x: scroll;
padding-bottom:3px;
scrollbar-width: thin;
scrollbar-color: var(--thumbBG) var(--scrollbarBG);
&::-webkit-scrollbar {
width: 1px;
height: 1px;
}
&::-webkit-scrollbar-track {
background: var(--scrollbarBG);
}
&::-webkit-scrollbar-thumb {
background-color: var(--thumbBG) ;
border-radius: 2px;
}
}
body{
margin:20px;
}
#app {
max-width:500px;
margin:auto;
}
var app = new Vue({
el: '#app',
mounted: function() {
document.querySelector('#myTab').addEventListener('mousewheel', (e) => {
document.querySelector('#myTab').scrollLeft = document.querySelector('#myTab').scrollLeft + e.deltaY;
e.preventDefault();
e.stopPropagation();
return false;
});
},
});
Also see: Tab Triggers