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.
.l-site
.l-nav
nav.nav
ul
li.nav-primary
a(href="#") Home
li.nav-primary
a(href="#") Approach
li.nav-primary
a(href="#") Work
li.nav-primary
a(href="#") People
li.nav-secondary
a(href="#") Jobs
li.nav-secondary
a(href="#") Blog
li.nav-secondary
a(href="#") Contact
.l-page
.menu
.menu-hamburger
section.band.band-a
.band-container
.band-inner
h1 Lorem ipsum dolor
p Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut porta, tellus ut convallis luctus, lorem diam mattis arcu, eu consequat dui tortor eget lacus. Donec metus ligula, rutrum volutpat neque vel, porta tincidunt dui. Phasellus convallis tristique nunc. Integer nunc nunc, finibus a maximus at, viverra ut lorem. Etiam id velit risus. Vestibulum sapien mauris, fermentum nec luctus nec, fringilla non orci. Nullam blandit porta tincidunt. Donec placerat pretium dapibus. Ut interdum lorem eu nibh tincidunt vulputate. Aenean aliquam gravida quam, vel pulvinar odio. Pellentesque sed feugiat ligula. Quisque sagittis porttitor dui, ac lacinia mauris tempor vel. Donec rutrum lorem id nulla consequat vulputate.
section.band.band-b
.band-container
.band-inner
h1 Proin sed aliquet
p Proin sed aliquet tellus. Etiam bibendum ligula in rhoncus imperdiet. Sed a sollicitudin dolor. Integer leo enim, tincidunt vel sagittis vel, vehicula non quam. Nunc mattis bibendum massa vel volutpat. Duis ligula ante, elementum luctus felis ut, ultricies aliquam dolor. Nunc et est mattis, fermentum nisl et, volutpat lacus. Nam ullamcorper urna non odio luctus volutpat. Praesent efficitur in risus at porttitor.
section.band.band-c
.band-container
.band-inner
h1 Sed consectetur neque
p Sed consectetur neque et libero placerat, dapibus laoreet sem condimentum. Nunc suscipit pharetra nunc ac interdum. Quisque justo magna, porttitor quis bibendum eu, ultrices nec justo. Cras mattis ut lectus at ullamcorper. Mauris vestibulum est sed sapien euismod, a pretium arcu lacinia. Donec pharetra non massa ac rhoncus. In in magna felis. Ut porta nec nunc a condimentum. Nullam ultricies sollicitudin enim ac scelerisque. Nam porta, leo in euismod suscipit, elit lorem eleifend neque, non hendrerit quam odio quis felis. Praesent id ullamcorper neque, in fermentum mauris. Curabitur sodales erat sed nisi dictum, sit amet vehicula eros malesuada.
section.band.band-d
.band-container
.band-inner
h1 Nulla tempor laoreet
p Nulla tempor laoreet sagittis. Donec molestie odio sit amet tincidunt egestas. Ut ut nisi nec felis vehicula pharetra. Nunc ullamcorper vitae lectus vitae consectetur. Quisque pharetra lorem metus, at lacinia magna malesuada non. Maecenas tristique risus quis massa convallis tempus in non turpis. Mauris pretium purus sed lacus euismod, eu cursus massa commodo. Nulla in erat ut ex imperdiet iaculis. Aliquam erat volutpat. Sed pellentesque et neque vitae accumsan. Etiam nec dolor quis est dignissim viverra. Nunc et pulvinar felis. Nulla in varius turpis. Curabitur non diam libero. Nam porttitor orci in metus sagittis
@import "bourbon";
$break-medium: 980px;
$nav-width: 240px;
$site-width: 1600px;
@import url(https://fonts.googleapis.com/css?family=Open+Sans:700,300,600,800,400);
html,
body {
margin: 0;
padding: 0;
background: lighten(#3a4043, 15%);
font-family: 'Open Sans', sans-serif;
}
.l-site {
margin: 0 auto;
max-width: $site-width;
position: relative;
z-index: 1;
&:before {
content: "";
position: fixed;
top: 0;
left: 0;
bottom: 0;
width: 50%;
display: block;
background: #3a4043;
z-index: 1;
}
}
.l-page {
position: relative;
margin-left: $nav-width;
background: #fff;
z-index: 2;
box-shadow: 1px 0 25px rgba(0,0,0,0.25);
@include transition(0.35s);
}
.l-nav {
position: absolute;
width: $nav-width;
display: block;
background: #3a4043;
top: 0;
bottom: 0;
left: 0;
z-index: 3;
}
.band {
h1 {
margin: 0;
padding: 0 0 10px;
color: #fff;
font-size: 32px;
}
p {
margin: 0;
padding: 0;
color: #fff;
font-size: 17px;
}
}
.band-container {
left: 0;
right: 0;
margin: 0 auto;
min-height: 85vh;
max-width: 960px;
display: table;
position: relative;
padding: 0 3em;
}
.band-inner {
display: table-cell;
vertical-align: middle;
padding: 3em 0 4em;
}
.band-a {
background: #69D2E7;
}
.band-b {
background: #F9D423;
}
.band-c {
background: #F38630;
}
.band-d {
background: #FF4E50;
}
.nav {
width: ($nav-width - 60);
position: fixed;
top: 0;
bottom: 0;
margin: 0;
padding: 30px;
overflow: auto;
ul {
margin: 0;
padding: 0;
list-style: none;
}
li {
margin: 0;
padding: 0;
@include transition(0.25s);
}
a {
color: #fff;
text-decoration: none;
font-size: 20px;
font-weight: 800;
display: block;
padding: 10px 0;
}
.nav-primary {
opacity: 1;
&:hover {
opacity: 0.7;
}
}
.nav-secondary {
opacity: 0.4;
&:hover {
opacity: 0.7;
}
}
}
.menu {
display: none;
position: fixed;
top: 25px;
left: 1.5em;
width: 24px;
height: 24px;
cursor: pointer;
z-index: 10;
&:hover {
.menu-hamburger:before,
.menu-hamburger:after {
width: 24px;
}
}
&.is-active {
.menu-hamburger {
background: none;
}
.menu-hamburger:before,
.menu-hamburger:after {
top: 0;
width: 24px;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.menu-hamburger:after {
-webkit-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg);
}
.menu-hamburger:hover {
-webkit-transform: scale(1.2);
-ms-transform: scale(1.2);
transform: scale(1.2);
}
}
}
.menu-hamburger {
position: relative;
width: 24px;
height: 4px;
margin: 10px 0;
background: #fff;
border-radius: 4px;
transition: all 300ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
&:before,
&:after {
content: '';
display: block;
width: 24px;
height: 4px;
background: #fff;
position: absolute;
border-radius: 4px;
transition: all 300ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
&:before {
top: -8px;
left: 0;
width: 22px;
}
&:after {
top: 8px;
width: 16px;
left: 0;
}
}
@media screen and (max-width: $break-medium) {
.menu {
display: block;
}
.l-site {
&.is-open {
overflow: hidden;
.l-page {
@include transform(translateX($nav-width));
}
}
}
.l-page {
margin-left: 0;
z-index: 3;
}
.l-nav {
z-index: 2;
}
.band-container {
padding: 0 1.5em;
}
}
$('.menu').on('click', function(){
if ($('.l-site').hasClass('is-open')) {
$('.menu').removeClass('is-active');
$('.l-site').removeClass('is-open');
} else {
$('.menu').addClass('is-active');
$('.l-site').addClass('is-open');
}
});
Also see: Tab Triggers