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 URL's 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 it's URL and the proper URL extention.
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.
<div class="nav_wrapper">
<!--<a class="menu-link" href="#menu"></a>-->
<div class="spinner-master">
<input type="checkbox" id="spinner-form" />
<label for="spinner-form" class="spinner-spin">
<div class="spinner diagonal part-1"></div>
<div class="spinner horizontal"></div>
<div class="spinner diagonal part-2"></div>
</label>
</div>
<a href="#search_box" class="btn" id="search">☌</a>
<nav id="menu" class="menu">
<ul class="dropdown">
<li ><a href="#Link" title="Link">Home</a>
<ul >
<li ><a href="#Link" title="Link">Link » </a>
<ul >
<li ><a href="#Link" title="Link">Link</a></li>
<li ><a href="#Link" title="Link">Link</a></li>
</ul>
</li>
<li ><a href="#Link" title="Link">About</a></li>
<li ><a href="#Link" title="Link">Link » </a>
<ul >
<li ><a href="#Link" title="Link">Link</a></li>
<li ><a href="#link" title="Link">Link</a></li>
<li ><a href="#Link" title="Link">Link </a></li>
</ul>
</li>
</ul>
</li>
<li ><a href="#Link" title="Link">Category</a>
<ul >
<li ><a href="#Link" title="Link ">Link</a></li>
<li ><a href="#Link" title="Link">Link</a></li>
</ul>
</li>
<li ><a href="#Link" title="Link">Portfolio</a>
<ul >
<li ><a href="#Link" title="Link">Link</a></li>
<li ><a href="#Link" title="Link">Link</a></li>
<li ><a href="#Link" title="Link">Link</a></li>
</ul>
</li>
<li ><a href="#Link" title="Link">Work</a>
<ul >
<li ><a href="#Link" title="Link">Link</a></li>
<li ><a href="#Link" title="Link">Link</a></li>
<li ><a href="#Link" title="Link">Link</a></li>
<li ><a href="#Link" title=" Link"> Link</a></li>
</ul>
</li>
<li ><a href="#Link" title="Link">Playground</a>
<ul >
<li ><a href="#Link" title="Link">Link </a></li>
<li ><a href="#Link" title="Link">Link</a></li>
<li ><a href="#Link" title="Link">Link</a></li>
</ul>
</li>
<li ><a href="#Link" title="Link">Sitemap</a></li>
</ul>
</nav>
<form class="search_box" id="search_box" action="/search/">
<input name="search_criteria" placeholder="Search here" value="" type="text">
<input class="search_icon" value="Search" type="submit">
</form>
</div>
<main>
<div id="hero"><img src="https://1.bp.blogspot.com/-Y00xzhfGdgE/W4fvOaGpxnI/AAAAAAAAPBQ/rJHeRtBr7-UDTV6Gy2RwwLC_-tMh_jSUACLcBGAs/s1600/How%2Bto%2BMake%2Ba%2BPerfect%2BMojito%2BCocktail.jpg"/></div>
<h1>Responsive Show and Hide Navigation</h1>
<p>Baseline italic prototype objectified. Headroom objectified usable interaction design iconography. Balsamiq fireworks. Bevel dribbble CSS. CSS archetype footer. Modal classical conditioning narrative. Grid splash screen grouping grouping. Prototype css3 leading contextual inquiry omnigraffle.</p>
<p>Paper prototype bootstrap. Wireframe usability testing interstitial sketches constraints. Script kitsch grouping complementary. Bauhaus pencil classical conditioning classical conditioning. Interactive wireframe. Steve jobs header. Alan cooper information architecture prägnanz. Rule of thirds fireworks color theory card-sorting artifact. User interface usability testing affordance. Interaction design iteration. Pencil kitsch walkthrough. Mockup leading. Color theory braindump retina adobe narrative.</p>
<p>Bevel dropdown serif sans-serif pixel-perfect. Mockup ascenders. Behavior change typesetting illustrator. Modal paper prototype visualization. Alan cooper modular scale. Abstraction 66-character line aesthetic. Interstitial resolution. Design jony ive typeface. Cognitive dissonance lightbox post-its grouping information architecture. Type front-end. Alan cooper typography fireworks. Photoshop design paper prototype ligature. Sitemap iteration archetype workflow.</p>
<p>Wireframe dieter rams. Bootstrap affordance innovate modern. Rule of thirds user. Typography dieter rams affordance. Usability typeface ethnography. Pencil design language mobile design language iconography. Affordance modern affordance rounded corners. CSS clarity. Modern classical conditioning hero message. Modular scale prägnanz measure. Usability retina css3.</p>
<p>Usable bauhaus. Typeface ethnography pencil. Narrative omnigraffle. Palette constraints. Aesthetic scenario. User interface design thinking glyph. Behavior change classical conditioning abstraction. User experience balance. Abstraction usability. Icon ascenders visualization keep it simple descender. User interface scenario. Palette measure abstraction vector persona. Responsive objectified palette user experience. </p>
<p>Workflow measure grouping. Tabs design hierarchy contour modal. Modal information architecture figure-ground aesthetic. Bauhaus bootstrap. Coach marks kerning. Header user experience drawer menu wireframe post-its. Abstraction visualization responsive. Css3 storyboard. Complementary rounded corners helvetica helvetica. </p>
<p>Jony ive iconography branding contrast dribbble. Front-end bootstrap persona vector. Ascenders serif. Jakob nielsen bauhaus ligature. Grouping narrative gestalt hero message ethnography. Baseline typography. Portfolio adobe coach marks. Delightful typography leading. </p>
<p/>Omnigraffle grid. Responsive resolution. Urbanized usability dropdown constraints. Jakob nielsen contour user-centered. Brainstorm kitsch vector rule of thirds. Keep it simple interactive artifact typography prototype. CSS usable. Splash screen pixel behavior change narrative. Visuals retina. </p>
<p>Alan cooper dropdown. Ethnography experience braindump. Color theory navigation. Gradient slab serif simplicity hero message photoshop. Photoshop jony ive design thinking card-sorting italic. Typesetting css3. Gradient glyph mockup. Kerning typesetting heuristic modern. Css3 clarity skeuomorphism. Scenario mental model. Bevel typesetting color theory. Kitsch type. Navigation leading baseline comic sans. Braindump slab serif. </p>
<p>Baseline italic prototype objectified. Headroom objectified usable interaction design iconography. Balsamiq fireworks. Bevel dribbble CSS. CSS archetype footer. Modal classical conditioning narrative. Grid splash screen grouping grouping. Prototype css3 leading contextual inquiry omnigraffle. </p>
<p>Paper prototype bootstrap. Wireframe usability testing interstitial sketches constraints. Script kitsch grouping complementary. Bauhaus pencil classical conditioning classical conditioning. Interactive wireframe. Steve jobs header. Alan cooper information architecture prägnanz. Rule of thirds fireworks color theory card-sorting artifact. User interface usability testing affordance. Interaction design iteration. Pencil kitsch walkthrough. Mockup leading. Color theory braindump retina adobe narrative. </p>
<p>Bevel dropdown serif sans-serif pixel-perfect. Mockup ascenders. Behavior change typesetting illustrator. Modal paper prototype visualization. Alan cooper modular scale. Abstraction 66-character line aesthetic. Interstitial resolution. Design jony ive typeface. Cognitive dissonance lightbox post-its grouping information architecture. Type front-end. Alan cooper typography fireworks. Photoshop design paper prototype ligature. Sitemap iteration archetype workflow. </p>
<p>Wireframe dieter rams. Bootstrap affordance innovate modern. Rule of thirds user. Typography dieter rams affordance. Usability typeface ethnography. Pencil design language mobile design language iconography. Affordance modern affordance rounded corners. CSS clarity. Modern classical conditioning hero message. Modular scale prägnanz measure. Usability retina css3.</p>
</main>
<footer>
<div class="separator" style="clear: both; text-align: center;">
<b><a href="https://www.arlinacode.com/2015/01/responsive-show-and-hide-navigation.html">Arlina Code</a></b></div>
</footer>
html {
font-family: sans-serif;
color: #4b5f65;
background: #f5f7fa;
}
nav {
width: 100%;
}
.nav_wrapper {
position: fixed;
left: 0;
top: 0;
width: 100%;
transition: top .5s ease-out;
background: #2f3b3f;
}
.scroll {
top: -90px;
}
.no-scroll {
top: 0;
z-index: 9999;
}
.btn {
padding: 10px 1%;
margin: 5px;
color: #fff;
text-decoration: none;
font-family: sans-serif;
transition: all 0.1s ease;
}
.btn:hover {
transition: all 0.1s ease;
}
main {
max-width: 800px;
margin: 0 auto;
}
main p {
1.2em;
}
#search {
float: right;
font-size: 30px;
padding: 2px 15px;
line-height: 40px;
color: #fff;
margin: 0;
font-weight: 700;
-webkit-transform: rotate(181deg);
-moz-transform: rotate(181deg);
-ms-transform: rotate(181deg);
-o-transform: rotate(181deg);
transform: rotate(181deg);
}
#search:hover {
color: #efa666;
}
.search_box {
clear: both;
width: 100%;
background: #e8ebf0;
padding: 0;
margin: 0;
height: 0;
overflow: hidden;
transition: all 0.1s ease-in-out;
}
.search_box.active {
height: auto;
padding: 15px 0;
}
.search_box input {
width: 80%;
font-size: 13px;
margin: 0 0 0 15px;
padding: 10px;
border: none;
background: #fff;
}
.search_box input:focus {
outline: none;
}
.search_box input.search_icon {
clear: both;
width: 10%;
height: auto;
padding: 10px;
margin: 0;
margin-left: -5px;
border: none;
color: #fff;
cursor: pointer;
background: #8c949d;
opacity: 1;
transition: all 0.1s ease;
}
.search_box input.search_icon:hover {
background: #efa666;
}
.menu-link {
display: none;
}
.spinner-master input[type=checkbox] {
display: none;
}
.menu {
width: 100%;
height: auto;
background: #2f3b3f;
transition: all 0.3s ease;
}
.menu ul {
padding: 0px;
margin: 0px;
list-style: none;
position: relative;
display: inline-block;
}
.menu > li > ul.sub_menu {
min-width: 10em;
padding: 4px 0;
background-color: #f4f4f4;
border: 1px solid #fff;
}
.menu ul li {
padding: 0px;
}
.menu > ul > li {
display: inline-block;
}
.menu ul li a {
display: block;
text-decoration: none;
color: #fff;
font-size: 14px;
}
.menu ul li a:hover {
background: #efa666;
color: #fff;
}
.menu ul li.hover > a {
background: #efa666;
color: #fff;
}
.menu ul li > a {
padding: 15px;
}
.menu ul ul {
display: none;
position: absolute;
top: 100%;
min-width: 160px;
background: #39484d;
}
.menu ul li:hover > ul {
display: block;
}
.menu ul ul > li {
position: relative;
}
.menu ul ul > li a {
padding: 10px 15px;
height: auto;
background: #39484d;
}
.menu ul ul > li a:hover {
background: #efa666;
color: #fff;
}
.menu ul ul ul {
position: absolute;
left: 100%;
top: 0;
}
#hero {
width: 100%;
height: auto;
background: #e8ebf0;
margin: 70px 0 20px 0;
}
#hero img {
width: 100%;
height: auto;
}
footer {
width: 100%;
padding: 10px;
color: #0099cc;
margin-top: 40px;
}
footer a {
color: #0099cc;
text-decoration: none;
}
@media all and (max-width: 768px) {
.example-header .container {
width: 100%;
}
#search {
padding: 10px;
}
.spinner-master * {
transition: all 0.3s;
box-sizing: border-box;
}
.spinner-master {
position: relative;
margin: 15px;
height: 30px;
width: 30px;
float: left;
}
.spinner-master label {
cursor: pointer;
position: absolute;
z-index: 99;
height: 100%;
width: 100%;
top: 5px;
left: 0;
}
.spinner-master .spinner {
position: absolute;
height: 4px;
width: 100%;
padding: 0;
background-color: #fff;
}
.spinner-master .diagonal.part-1 {
position: relative;
float: left;
}
.spinner-master .horizontal {
position: relative;
float: left;
margin-top: 4px;
}
.spinner-master .diagonal.part-2 {
position: relative;
float: left;
margin-top: 4px;
}
.spinner-master input[type=checkbox]:checked ~ .spinner-spin > .horizontal {
opacity: 0;
}
.spinner-master input[type=checkbox]:checked ~ .spinner-spin > .diagonal.part-1 {
transform: rotate(135deg);
-webkit-transform: rotate(135deg);
margin-top: 10px;
}
.spinner-master input[type=checkbox]:checked ~ .spinner-spin > .diagonal.part-2 {
transform: rotate(-135deg);
-webkit-transform: rotate(-135deg);
margin-top: -12px;
}
a.menu-link {
display: block;
color: #fff;
float: left;
text-decoration: none;
padding: 10px 16px;
font-size: 1.5em;
}
a.menu-link:hover {
color: #efa666;
}
a.menu-link:after {
content: "\2630";
font-weight: normal;
}
a.menu-link.active:after {
content: "\2715";
}
.menu {
clear: both;
min-width: inherit;
float: none;
}
.menu, .menu > ul ul {
overflow: hidden;
max-height: 0;
background-color: #39484d;
}
.menu > li > ul.sub-menu {
padding: 0px;
border: none;
}
.menu.active, .menu > ul ul.active {
max-height: 55em;
}
.menu ul {
display: inline;
}
.menu li, .menu > ul > li {
display: block;
}
.menu > ul > li:last-of-type a {
border: none;
}
.menu li a {
color: #fff;
display: block;
padding: 0.8em;
position: relative;
}
.menu li.has-submenu > a:after {
content: '+';
position: absolute;
top: 0;
right: 0;
display: block;
font-size: 1.5em;
padding: 0.55em 0.5em;
}
.menu li.has-submenu > a.active:after {
content: "-";
}
.menu ul ul > li a {
background-color: #39484d;
padding: 10px 18px 10px 30px;
}
.menu ul li a:hover {
background: #4b5f65;
color: #fff;
}
.menu ul li.hover > a {
background: #4b5f65;
color: #fff;
}
.menu ul ul, .menu ul ul ul {
display: inherit;
position: relative;
left: auto;
top: auto;
border: none;
}
.search_box {
position: absolute;
top: 60px;
left: 0;
z-index: 10;
}
.search_box input {
width: 70%;
}
.search_box input.search_icon {
width: 17%;
}
#hero {
height: 200px;
};
}
$("ul li:has(ul)").addClass("has-submenu");$("ul li ul").addClass("sub-menu");$("ul.dropdown li").hover(function(){$(this).addClass("hover")},function(){$(this).removeClass("hover")});var $menu=$("#menu"),$menulink=$("#spinner-form"),$search=$("#search"),$search_box=$(".search_box"),$menuTrigger=$(".has-submenu > a");$menulink.click(function(e){$menulink.toggleClass("active");$menu.toggleClass("active");if($search.hasClass("active")){$(".menu.active").css("padding-top","50px")}});$search.click(function(e){e.preventDefault();$search_box.toggleClass("active")});$menuTrigger.click(function(e){e.preventDefault();var t=$(this);t.toggleClass("active").next("ul").toggleClass("active")});$("ul li:has(ul)");$(function(){var e=$(document).scrollTop();var t=$(".nav_wrapper").outerHeight();$(window).scroll(function(){var n=$(document).scrollTop();if($(document).scrollTop()>=50){$(".nav_wrapper").css("position","fixed")}else{$(".nav_wrapper").css("position","fixed")}if(n>t){$(".nav_wrapper").addClass("scroll")}else{$(".nav_wrapper").removeClass("scroll")}if(n>e){$(".nav_wrapper").removeClass("no-scroll")}else{$(".nav_wrapper").addClass("no-scroll")}e=$(document).scrollTop()})})
Also see: Tab Triggers