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 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.
<input type="checkbox" id="menu">
<label for="menu" onclick></label>
<nav role="off-canvas">
<ul>
<li><a href="#">Stream</a></li>
<li><a href="#">Lab</a></li>
<li><a href="#">Projects</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
<div class="content">
<p>Fap cray leggings wes anderson, freegan shoreditch bespoke locavore echo park. Pinterest post-ironic sustainable letterpress, leggings echo park gentrify kale chips VHS cosby sweater flexitarian chillwave aesthetic. Master cleanse small batch sustainable, 3 wolf moon butcher readymade locavore quinoa. Hella sartorial mcsweeney's, squid banh mi locavore vice four loko brooklyn next level stumptown. Fap stumptown fingerstache mustache. Forage 3 wolf moon iphone, williamsburg bushwick mcsweeney's yr pour-over photo booth sustainable swag chillwave terry richardson. Lo-fi direct trade yr banh mi butcher, fingerstache odd future flexitarian thundercats mumblecore selvage retro.</p><p>Twee jean shorts whatever fixie. Carles wolf portland whatever beard mustache authentic lo-fi, cosby sweater squid raw denim leggings gluten-free. Wayfarers ethical tumblr, fingerstache whatever messenger bag hella letterpress polaroid. Forage pitchfork pop-up, four loko letterpress whatever pickled mlkshk polaroid gluten-free occupy mcsweeney's narwhal master cleanse typewriter. American apparel chambray wayfarers, selvage raw denim pork belly fixie Austin hoodie pickled skateboard fap messenger bag four loko cred. Skateboard terry richardson thundercats, high life polaroid american apparel four loko pitchfork. Cred street art art party vegan.</p><p>8-bit flexitarian wes anderson seitan, pinterest skateboard salvia you probably haven't heard of them squid pitchfork. Umami jean shorts gluten-free williamsburg, gentrify put a bird on it vice vegan street art fap VHS narwhal wes anderson authentic. Tofu shoreditch you probably haven't heard of them helvetica odd future hella. Mustache pickled ennui, banksy pinterest terry richardson godard art party sustainable ethnic flexitarian four loko umami aesthetic. Lomo wolf hoodie wes anderson cliche, biodiesel organic american apparel freegan mumblecore. Brunch thundercats freegan iphone, pop-up readymade bushwick street art tattooed PBR stumptown. Hoodie Austin food truck cosby sweater, shoreditch lomo you probably haven't heard of them chambray leggings irony.</p><p>Photo booth keffiyeh iphone occupy. Vice messenger bag occupy pitchfork butcher. Hoodie truffaut carles swag, before they sold out umami pop-up typewriter beard iphone sustainable. Blog Austin mcsweeney's pork belly, carles keffiyeh put a bird on it keytar gastropub seitan bespoke fanny pack 8-bit narwhal. Mlkshk echo park lomo, quinoa trust fund keytar chillwave cosby sweater mixtape pour-over master cleanse iphone food truck mcsweeney's kogi. Mumblecore lomo keffiyeh, raw denim swag leggings ennui authentic mixtape vice banh mi marfa street art. Umami vice fixie put a bird on it polaroid artisan, godard bushwick.</p><p>Aesthetic wolf wayfarers before they sold out sustainable semiotics next level, readymade pinterest seitan fixie. Portland retro mustache photo booth kale chips brunch thundercats synth. Truffaut tumblr blog flexitarian artisan, tofu brunch umami lo-fi pickled put a bird on it odd future 3 wolf moon salvia. Leggings fingerstache pinterest, skateboard tumblr four loko sriracha PBR. Mumblecore fanny pack polaroid vinyl, swag twee odd future. Mixtape sustainable scenester before they sold out semiotics lomo quinoa, butcher odd future PBR put a bird on it. High life vegan chillwave, next level american apparel dreamcatcher fingerstache.</p><p>Tattooed viral fixie odd future, craft beer jean shorts cliche single-origin coffee. Pork belly art party lo-fi iphone mumblecore. Skateboard american apparel bushwick tattooed, salvia retro fixie carles pop-up leggings. Odd future readymade cliche keytar, next level pinterest street art polaroid sartorial banksy small batch. Truffaut food truck salvia cray farm-to-table. Terry richardson occupy sartorial post-ironic bushwick pinterest, fixie american apparel master cleanse marfa cred. Farm-to-table marfa fingerstache scenester wes anderson.</p><p>Seitan freegan hella fap bushwick, keffiyeh four loko leggings chillwave typewriter high life. Keytar marfa VHS craft beer lo-fi PBR. Bushwick kogi readymade, pour-over biodiesel bicycle rights beard blog locavore photo booth aesthetic. Cray sriracha +1, butcher dreamcatcher salvia mlkshk wayfarers umami. Ethnic fap sustainable, master cleanse wes anderson pitchfork vinyl polaroid gentrify umami. Stumptown farm-to-table wes anderson, VHS flexitarian fixie sartorial dreamcatcher chambray banh mi wayfarers. Typewriter +1 semiotics jean shorts echo park mcsweeney's.</p><p>Hoodie direct trade bushwick ennui truffaut, authentic wolf mlkshk put a bird on it typewriter. Raw denim whatever gluten-free, sustainable twee narwhal hella polaroid mixtape flexitarian cosby sweater readymade hoodie etsy. Food truck twee polaroid, jean shorts readymade retro wolf raw denim 3 wolf moon pinterest godard sriracha blog cray. Cosby sweater PBR hoodie pitchfork. Iphone raw denim seitan trust fund, bespoke swag biodiesel wolf single-origin coffee bushwick quinoa semiotics. Trust fund craft beer occupy, wes anderson tattooed pinterest tumblr. Mcsweeney's american apparel blog mustache.</p></div>
</div>
@import "compass/css3";
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,600,700);
* {
box-sizing:border-box;
}
html,
body {
width:100%;
height:100%;
}
body {
margin:.55em;
color: rgb(0, 0, 0);
background: url(http://subtlepatterns.subtlepatterns.netdna-cdn.com/patterns/shattered.png);
}
/* custom scrollbar */
::-webkit-scrollbar {
width: .95em;
}
::-webkit-scrollbar-track {
background-color: rgba(217, 217, 217, .5);
}
::-webkit-scrollbar-thumb {
background: rgba(184, 184, 184, .5);
box-shadow:
inset .05em .05em 0 rgba(0, 0, 0, .1),
inset 0 -.05em 0 rgba(0, 0, 0, .07)
;
}
/* dummy content */
.content {
float:left;
font: 1em 'Open Sans', sans-serif;
margin:.75em 0 0 0;
transition: margin .3s ease-in-out;
> p {
margin:.25em 0 .75em 0;
}
}
/* Advanced Checkbox Hack */
body { -webkit-animation: bugfix infinite 1s; }
@-webkit-keyframes bugfix { from {padding:0;} to {padding:0;} }
input[type=checkbox] {
position: absolute;
top: -9999px;
left: -9999px;
}
label {
position: absolute;
left:0;
display:none;
width:2em;
height:2.25em;
padding:.35em;
font-size:1.1em;
color:#fff;
transition:color .3s ease-in-out;
cursor: pointer;
user-select:none;
margin:0;
background:rgba(0, 0, 0, .4);
}
/* big screens */
nav[role="off-canvas"] {
position:relative;
width: 50em;
margin: 0 auto;
transition-duration: .3s, .5s;
transition-timing-function: ease-in-out;
transition-property: left, opacity, box-shadow;
a {
color:#fff;
text-decoration:none;
font: 1.4em 'Open Sans', sans-serif;
transition:color .3s ease-in-out;
display:table-cell;
vertical-align: middle;
}
ul {
padding: 0;
margin: 0 auto;
width:100%;
> li {
float:left;
padding:.55em .55em;
width:8em;
height:8em;
margin:.5em;
opacity:.8;
text-transform:uppercase;
display: table;
background:hsla(11, 94%, 50%, .65);
cursor: pointer;
text-align:center;
transition-duration: .3s;
transition-timing-function: ease-in-out;
transition-property: box-shadow, color, opacity, padding-left;
cursor: pointer;
&:hover {
color:#fff;
opacity:1;
box-shadow:0 0 0 .5em rgba(255, 255, 255, .95);
> a {
color:#fff;
}
}
&:nth-child(2) {
background:hsla(44, 94%, 50%, .65);
}
&:nth-child(3) {
background:hsla(114, 94%, 50%, .65);
}
&:nth-child(4) {
background:hsla(184, 94%, 50%, .65);
}
&:nth-child(5) {
background:hsla(224, 94%, 50%, .65);
}
}
}
}
/* small screens */
@media screen and (max-width: 44em) {
$menu_width: 20em;
$content_offset : .5em;
html,
body {
margin:0;
overflow-x:hidden;
}
.content {
margin:2.5em .5em 0 .5em;
}
nav[role="off-canvas"] {
position:absolute;
top:3em;
left:-$menu_width;
width: $menu_width;
opacity:0;
ul > li {
height:100%;
width:100%;
text-align:left;
margin:0;
&:hover {
box-shadow:inset 0 0 0 .15em rgba(255, 255, 255, .45);
}
}
}
label {
display:block;
}
label:after {
position: absolute;
right: .25em;
top: 0;
content:"\2261";
font-size:1.8em;
}
label:hover,
input:checked ~ label {
color:#000;
}
input:checked ~ nav[role="off-canvas"] {
opacity:1;
left:0;
box-shadow:-30em 0 0 30em rgba(0, 0, 0, .3);
ul > li {
padding: .55em .55em .55em 1.5em;
&:hover {
padding-left:3.5em;
}
&:after {
position:absolute;
right:.25em;
content:"\203A";
font: bold 1.4em sans-serif;
color:inherit;
}
}
}
input:checked ~ .content {
margin-left: $menu_width + $content_offset;
margin-right:-($menu_width + $content_offset);
}
}
/**
Off Canvas
# What? #
Part of my "Responsive Menu Concepts" article on CSS-Tricks
https://css-tricks.com/responsive-menu-concepts
# 2012 by Tim Pietrusky
# timpietrusky.com
**/
Also see: Tab Triggers