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.
<nav id="navSidebar">
<header id="navHeader" style="background:url('http://www.tactivedigital.com/wp-content/uploads/2015/03/slide1.jpg') no-repeat center center; background-size: cover; overflow: hidden;">
<div class="row">
<div class="col">
</div>
</div>
</header>
<section class="container" id="breadcrumbs">
<div class="row">
<ul class="col">
<li><a href="">Work</a> <span uk-icon="icon: chevron-right"></span></li>
<li>Project Name</li>
</ul>
</div>
</section>
<section class="container" id="one">
<div class="row">
<ul class="col">
<li class="header">Jump to</li>
<a href=""><li><span>i.</span><span>Introduction</span></li></a>
<a href=""><li><span>ii.</span><span>Project Details</span></li></a>
<a href=""><li><span>iii.</span><span>Conception</span></li></a>
<a href=""><li><span>iv.</span><span>Components</span></li></a>
<a href=""><li><span>v.</span><span>Development</span></li></a>
<a href=""><li><span>vi.</span><span>Milestones</span></li></a>
<a href=""><li><span>vii.</span><span>Issues & Resolutions</span></li></a>
<a href=""><li><span>viii.</span><span>Conclusion (tl;dr)</span></li></a>
<a href=""><li><span>ix.</span><span>Demo</span></li></a>
</ul>
</div>
</section>
<section class="container" id="two">
<div class="row">
<ul class="col">
<li class="header">Nav</li></a>
<a href=""><li>Home</li></a>
<a href=""><li>Work</li></a>
<a href=""><li>About</li></a>
<a href=""><li>Contact</li></a>
<a href=""><li>Social</li></a>
<a href=""><li>README.md</li></a>
</ul>
</div>
</section>
</nav>
<main class="container" id="mainContent">
<h2><a id="menu">Click me to see! <span class="uk-icon" uk-icon="menu"></span></a></h2>
<p>Do so written as raising parlors spirits mr elderly. Made late in of high left hold. Carried females of up highest calling. Limits marked led silent dining her she far. Sir but elegance marriage dwelling likewise position old pleasure men. Dissimilar themselves simplicity no of contrasted as. Delay great day hours men. Stuff front to do allow to asked he.</p>
<p>Advanced extended doubtful he he blessing together. Introduced far law gay considered frequently entreaties difficulty. Eat him four are rich nor calm. By an packages rejoiced exercise. To ought on am marry rooms doubt music. Mention entered an through company as. Up arrived no painful between. It declared is prospect an insisted pleasure.</p>
<p>Denote simple fat denied add worthy little use. As some he so high down am week. Conduct esteems by cottage to pasture we winding. On assistance he cultivated considered frequently. Person how having tended direct own day man. Saw sufficient indulgence one own you inquietude sympathize.</p>
<p>Same an quit most an. Admitting an mr disposing sportsmen. Tried on cause no spoil arise plate. Longer ladies valley get esteem use led six. Middletons resolution advantages expression themselves partiality so me at. West none hope if sing oh sent tell is.</p>
<p>Why painful the sixteen how minuter looking nor. Subject but why ten earnest husband imagine sixteen brandon. Are unpleasing occasional celebrated motionless unaffected conviction out. Evil make to no five they. Stuff at avoid of sense small fully it whose an. Ten scarcely distance moreover handsome age although. As when have find fine or said no mile. He in dispatched in imprudence dissimilar be possession unreserved insensible. She evil face fine calm have now. Separate screened he outweigh of distance landlord.</p>
<p>Stronger unpacked felicity to of mistaken. Fanny at wrong table ye in. Be on easily cannot innate in lasted months on. Differed and and felicity steepest mrs age outweigh. Opinions learning likewise daughter now age outweigh. Raptures stanhill my greatest mistaken or exercise he on although. Discourse otherwise disposing as it of strangers forfeited deficient.</p>
<p>Prepared do an dissuade be so whatever steepest. Yet her beyond looked either day wished nay. By doubtful disposed do juvenile an. Now curiosity you explained immediate why behaviour. An dispatched impossible of of melancholy favourable. Our quiet not heart along scale sense timed. Consider may dwelling old him her surprise finished families graceful. Gave led past poor met fine was new.</p>
<p>Residence certainly elsewhere something she preferred cordially law. Age his surprise formerly mrs perceive few stanhill moderate. Of in power match on truth worse voice would. Large an it sense shall an match learn. By expect it result silent in formal of. Ask eat questions abilities described elsewhere assurance. Appetite in unlocked advanced breeding position concerns as. Cheerful get shutters yet for repeated screened. An no am cause hopes at three. Prevent behaved fertile he is mistake on.</p>
<p>By in no ecstatic wondered disposal my speaking. Direct wholly valley or uneasy it at really. Sir wish like said dull and need make. Sportsman one bed departure rapturous situation disposing his. Off say yet ample ten ought hence. Depending in newspaper an september do existence strangers. Total great saw water had mirth happy new. Projecting pianoforte no of partiality is on. Nay besides joy society him totally six.</p>
</main>
<div id="navFade"></div>
body {
width: 100%;
height: 100%;
}
#navFade {
display: none;
z-index: 99;
content: "";
// background: url('http://www.tripwiremagazine.com/wp-content/uploads/2013/05/7.jpg') no-repeat center center;
background-size: cover;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.65);
// background-blend-mode: hard-light;
// filter: grayscale(75%);
}
.noscroll {
overflow: hidden;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
}
#navSidebar {
background: #eee;
width: 256px;
height: 100%;
overflow-y: scroll;
margin: 0;
// box-shadow: 8px 5px 20px rgba(0,0,0,0.19), 4px 0 6px rgba(0,0,0,0.23);
position: fixed;
top: 0;
bottom: 0;
left: -256px;
z-index: 999;
& #navHeader {
background: #505050;
width: 100%;
height: 150px;
border-bottom: none;
margin-bottom: 0; // .75rem
display: flex;
align-items: center;
justify-content: center;
& h2 {
color: white;
font-size: 1.25rem;
line-height: 1;
margin: 0;
}
}
& #breadcrumbs {
padding-bottom: 0; // .5rem
& ul > li {
display: inline-block;
}
& .uk-icon {
position: relative;
top: -1px;
}
}
& #one li {
flex-direction: row;
justify-content: flex-start;
& span {
min-width: 25px;
}
}
& section {
padding-bottom: 1rem;
margin-bottom: 1rem;
border-bottom: 1px dotted rgba(0,0,0,.25);
&:last-child { border-bottom: none; }
}
& li {
font-family: ClearFont, sans-serif;
font-size: 12px;
letter-spacing: .5px;
line-height: 1;
margin: 0;
padding: .5rem 0;
&.header {
font-size: 16px;
text-transform: uppercase;
letter-spacing: 0;
font-family: Arial;
font-weight: bold;
color: rgba(0,0,0,.65);
}
}
}
$(document).ready(function() {
// set vars for this function
let sidebar = $("#navSidebar");
let sidebarList1 = $("#one li");
let sidebarList2 = $("#two li");
let body = $("body");
let main = $("#mainContent");
let dark = $("#navFade");
let bounceIn = "transition.bounceIn";
let bounceDownIn = "transition.bounceDownIn";
let slideLeftIn = "transition.slideLeftIn";
let slideRightIn = "transition.slideRightIn";
let slideUpIn = "transition.slideUpIn";
let slideDownIn = "transition.slideDownIn";
let fadeIn = "transition.fadeIn";
let fadeOut = "transition.fadeOut";
// animate sidebar slidein on click
$("#menu").on("click", function() {
sidebar.velocity({
translateX: "256px"
}, 600, [ 30, 15 ])
// SPRING PHYSICS
// Pass a two-item array in the form of [ tension, friction ].
// A higher tension (default: 500) increases total speed and bounciness.
// A lower friction (default: 20) increases ending vibration speed.
// animate nav entry
sidebarList1.velocity( slideLeftIn, {
stagger: 0,
drag: true,
display: "flex" })
sidebarList2.velocity( slideLeftIn, {
stagger: 0,
drag: true })
$("#breadcrumbs").velocity( slideLeftIn, {
stagger: 0,
drag: true })
$("#navHeader .row").velocity( slideDownIn, {
display: "flex" });
// fade and blur background
dark.velocity( fadeIn, 300);
body.addClass("noscroll");
}); // end open sidebar
// sidebar close on content click
$("#navFade").on("click", function() {
sidebar.velocity("reverse")
dark.velocity(fadeOut, 300)
main.velocity("reverse");
body.removeClass("noscroll");
}); // end close sidebar
});
Also see: Tab Triggers