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 class="logo">Welcome!</h1>
<nav>
<ul class="nav-list">
<li>
<a href="#art-1">Article 1</a>
</li>
<li>
<a href="#art-2">Article 2</a>
</li>
<li>
<a href="#art-3">Article 3</a>
</li>
<li>
<a href="#art-4">Article 4</a>
</li>
<li>
<a href="#art-5">Article 5</a>
</li>
<li>
<a href="#art-6">Article 6</a>
</li>
</ul>
</nav>
</header>
<section class="main">
<h1>Scroll and look at scrollbar</h1>
<article id="art-1" class="first-article article">
<h2>Article 1</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vitae tempus quam pellentesque nec nam. Nibh mauris cursus mattis molestie a. Sed id semper risus in hendrerit gravida rutrum. Urna condimentum mattis pellentesque id nibh tortor id. Lobortis scelerisque fermentum dui faucibus in ornare. Etiam erat velit scelerisque in dictum non. Sit amet tellus cras adipiscing enim eu turpis. Felis eget nunc lobortis mattis aliquam faucibus purus in massa. Tellus in hac habitasse platea dictumst vestibulum. Congue nisi vitae suscipit tellus mauris a. Augue mauris augue neque gravida. Purus sit amet luctus venenatis. Molestie at elementum eu facilisis sed. Urna condimentum mattis pellentesque id nibh.</p>
</article>
<article id="art-2" class="second-article article">
<h2>Article 2</h2>
<p>Ornare massa eget egestas purus viverra accumsan in nisl nisi. Tristique sollicitudin nibh sit amet commodo nulla. Tellus id interdum velit laoreet id donec. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Massa tempor nec feugiat nisl pretium fusce id. Augue lacus viverra vitae congue eu consequat ac felis donec. Bibendum est ultricies integer quis auctor elit sed. Faucibus purus in massa tempor nec. Integer malesuada nunc vel risus commodo viverra maecenas accumsan. Sem integer vitae justo eget magna fermentum iaculis eu non. Diam sit amet nisl suscipit. Eget nullam non nisi est sit amet. Sed adipiscing diam donec adipiscing tristique risus. Nec feugiat in fermentum posuere urna nec tincidunt.</p>
</article>
<article id="art-3" class="third-article article">
<h2>Article 3</h2>
<p>Vel quam elementum pulvinar etiam non quam lacus suspendisse. Nisl nisi scelerisque eu ultrices vitae auctor eu. Nisi lacus sed viverra tellus in hac. Placerat in egestas erat imperdiet sed euismod nisi. Orci a scelerisque purus semper eget duis at tellus at. Neque vitae tempus quam pellentesque nec nam. Orci nulla pellentesque dignissim enim sit. Leo a diam sollicitudin tempor. Facilisis magna etiam tempor orci eu. Libero justo laoreet sit amet cursus sit amet. Ultricies integer quis auctor elit sed vulputate mi sit amet. Purus gravida quis blandit turpis cursus in hac habitasse. A diam sollicitudin tempor id eu. Non nisi est sit amet facilisis magna etiam tempor.</p>
</article>
<article id="art-4" class="fourth-article article">
<h2>Article 4</h2>
<p>Vestibulum lectus mauris ultrices eros in cursus turpis. Habitant morbi tristique senectus et netus. Amet volutpat consequat mauris nunc congue nisi vitae suscipit tellus. Vel turpis nunc eget lorem dolor sed viverra ipsum nunc. Iaculis urna id volutpat lacus laoreet non curabitur gravida arcu. Viverra maecenas accumsan lacus vel. Turpis egestas integer eget aliquet nibh praesent. Ut porttitor leo a diam. Placerat orci nulla pellentesque dignissim enim. In massa tempor nec feugiat nisl pretium fusce id velit. Felis imperdiet proin fermentum leo vel orci. Quam id leo in vitae turpis massa. Convallis convallis tellus id interdum velit laoreet id donec. Id neque aliquam vestibulum morbi. Gravida dictum fusce ut placerat. Maecenas ultricies mi eget mauris pharetra et. Massa placerat duis ultricies lacus sed turpis tincidunt id aliquet. Praesent tristique magna sit amet purus gravida quis blandit. Eget velit aliquet sagittis id consectetur purus ut faucibus pulvinar. Sagittis purus sit amet volutpat consequat mauris nunc congue.</p>
</article>
<article id="art-5" class="fifth-article article">
<h2>Article 5</h2>
<p>Vestibulum lectus mauris ultrices eros in cursus turpis. Habitant morbi tristique senectus et netus. Amet volutpat consequat mauris nunc congue nisi vitae suscipit tellus. Vel turpis nunc eget lorem dolor sed viverra ipsum nunc. Iaculis urna id volutpat lacus laoreet non curabitur gravida arcu. Viverra maecenas accumsan lacus vel. Turpis egestas integer eget aliquet nibh praesent. Ut porttitor leo a diam. Placerat orci nulla pellentesque dignissim enim. In massa tempor nec feugiat nisl pretium fusce id velit. Felis imperdiet proin fermentum leo vel orci. Quam id leo in vitae turpis massa. Convallis convallis tellus id interdum velit laoreet id donec. Id neque aliquam vestibulum morbi. Gravida dictum fusce ut placerat. Maecenas ultricies mi eget mauris pharetra et. Massa placerat duis ultricies lacus sed turpis tincidunt id aliquet. Praesent tristique magna sit amet purus gravida quis blandit. Eget velit aliquet sagittis id consectetur purus ut faucibus pulvinar. Sagittis purus sit amet volutpat consequat mauris nunc congue.</p>
</article>
<article id="art-6" class="sixth-article article">
<h2>Article 6</h2>
<p>Vestibulum lectus mauris ultrices eros in cursus turpis. Habitant morbi tristique senectus et netus. Amet volutpat consequat mauris nunc congue nisi vitae suscipit tellus. Vel turpis nunc eget lorem dolor sed viverra ipsum nunc. Iaculis urna id volutpat lacus laoreet non curabitur gravida arcu. Viverra maecenas accumsan lacus vel. Turpis egestas integer eget aliquet nibh praesent. Ut porttitor leo a diam. Placerat orci nulla pellentesque dignissim enim. In massa tempor nec feugiat nisl pretium fusce id velit. Felis imperdiet proin fermentum leo vel orci. Quam id leo in vitae turpis massa. Convallis convallis tellus id interdum velit laoreet id donec. Id neque aliquam vestibulum morbi. Gravida dictum fusce ut placerat. Maecenas ultricies mi eget mauris pharetra et. Massa placerat duis ultricies lacus sed turpis tincidunt id aliquet. Praesent tristique magna sit amet purus gravida quis blandit. Eget velit aliquet sagittis id consectetur purus ut faucibus pulvinar. Sagittis purus sit amet volutpat consequat mauris nunc congue.</p>
</article>
</section>
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Pacifico&display=swap');
$gray: #efefef;
$dark-gray: #817f82;
$green: #34d1bf;
$black: #070707;
// Custom scrollbar
// For Firefox you write this here
html {
scrollbar-width: thin; // normal or you can put you own dimension (the best unit for scrollbar is wv)
scrollbar-color: $green $black; // first color is for thumb, second one is for track
}
// For other browsers you write this here
html::-webkit-scrollbar {
width: 3vw;
}
html::-webkit-scrollbar-thumb {
background-color: $green;
}
html::-webkit-scrollbar-track {
background-color: $black;
}
// General styles, nothing special
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
font-size: 100%;
scroll-behavior: smooth;
}
ul {
list-style-type: none;
li {
margin-top: .5em;
}
li + li {
margin-left: .8em;
}
}
a {
color: $black;
text-decoration: none;
font-size: 18px;
display: inline-block;
transition: all 500ms ease-in-out;
&:hover {
transform: translateY(-5px);
color: $green;
}
}
header {
max-width: 800px;
margin: 0 auto;
padding: 1em 0;
display: flex;
align-items: center;
justify-content: space-between;
.nav-list {
display: flex;
margin-left: auto;
}
.logo {
font-family: "Pacifico", cursive;
color: $green;
}
}
body {
background: $gray;
font-family: 'Nunito', sans-serif;
color: $black;
.main {
max-width: 800px;
margin: 4rem auto;
h1 {
font-size: 30px;
position: relative;
&::after {
position: absolute;
content: '';
background: $green;
width: 120px;
height: 5px;
border-radius: 200px;
bottom: 0px;
left: 255px;
}
}
.article {
margin-top: 3em;
background: $dark-gray;
padding: 2em;
color: $gray;
border-radius: 50px 0px;
box-shadow: 5px 10px 30px rgba(0 0 0 / .33);
p {
margin-top: 1em;
}
}
}
}
@media (max-width: 600px){
header, .main {
width: 95%;
margin: 0 auto;
}
h1 {
font-size: 22px;
}
.article {
h2 {
font-size: 18px;
}
p {
font-size: 14px;
}
}
a {
font-size: 12px;
}
}
Also see: Tab Triggers