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.
<meta name="viewport" content="width=device-width, user-scalable=no" />
<link href='https://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700,300italic,400italic,500italic,700italic' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,300italic,700' rel='stylesheet' type='text/css'>
<div id="menu">
<div class="abrir_menu"><span>MENU</span></div>
<div class="menu_aberto">
<div id="navigator">
<ul class="nav">
<li class="title">navpad mobile</li>
<li><a href="#" title="" style="border:none;">Home</a></li>
<li><a href="#" title="">About Us</a></li>
<li>
<a href="#container" title="">Products</a>
<ul>
<li><a href="#" title="">Lorem Ipsum</a></li>
<li><a href="#" title="">Dolor Sit</a></li>
<li><a href="#" title="">Amet Fortn</a></li>
<li><a href="#container" title="">Aliquam Vitae</a>
<ul>
<li><a href="#" title="">Lorem Ipsum</a></li>
<li>
<a href="#" title="">Class Aptent</a>
<ul>
<li><a href="#" title="">Lorem Ipsum</a></li>
<li><a href="#" title="">Class Aptent</a></li>
</ul>
</li>
<li><a href="#" title="">Lorem Ipsum</a></li>
<li><a href="#" title="">Class Aptent</a></li>
<li><a href="#" title="">Sed Interdum Felis</a></li>
<li><a href="#" title="">Etiam Quis Aucto</a></li>
</ul>
</li>
<li><a href="#" title="">Class Aptent</a></li>
<li><a href="#" title="">Sed Interdum Felis</a></li>
<li><a href="#" title="">Etiam Quis Aucto</a></li>
</ul>
</li>
<li>
<a href="#container" title="#" class="parent">Projects</a>
<ul>
<li><a href="#" title="">Dolor Sit</a></li>
<li><a href="#" title="">Amet Fortn</a></li>
<li><a href="#" title="">Lorem Ipsum</a></li>
<li>
<a href="#" title="">Class Aptent</a>
<ul>
<li><a href="#" title="">Lorem Ipsum</a></li>
<li><a href="#" title="">Class Aptent</a></li>
</ul>
</li>
<li><a href="#" title="">Sed Interdum Felis</a></li>
</ul>
</li>
<li><a href="#" title="">Media</a></li>
<li><a href="#" title="">Downloads</a></li>
<li><a href="#" title="">Contact</a></li>
</ul>
</div>
</div>
</div>
<div class="alert">
Please, test on your mobile device too.
</div>
/* Resets */
*{ margin: 0; padding: 0; }
body{ font-family: 'Ubuntu', sans-serif; font-weight: 400; background: #ddd; }
a{ text-decoration: none; }
/* Resets */
.alert{ color: #666; text-align: center; margin: 50px 0; }
@media handheld, screen and (min-width: 641px){
.no_scroll{ overflow-y: hidden; }
.abrir_menu{ display: none; }
#menu{
max-width: 960px;
height: 50px;
margin: 0 auto;
}
#navigator{
height: 50px;
line-height: 50px;
box-shadow: 0 7px 6px -7px #373435;
-webkit-box-shadow: 0 7px 6px -7px #373435;
-moz-box-shadow: 0 7px 6px -7px #373435;
}
#navigator .title{ display: none; }
#navigator ul{ list-style: none; }
#navigator > ul > li{
width: 14.28%;
float: left;
}
#navigator > ul > li > a{
color: #fefefe;
font-size: 15px;
font-family: 'Open Sans Condensed', sans-serif;
text-transform: uppercase;
letter-spacing: 0.5px;
text-align: center;
display: block;
background: #333;
}
#navigator > ul > li:hover > a{
background: #555;
}
#navigator ul li > ul,
#navigator ul li li > ul,
#navigator ul li li li > ul,
#navigator ul li li li li> ul,
#navigator ul li li li li li > ul{ display: none; }
#navigator ul li:hover > ul,
#navigator ul li li:hover > ul,
#navigator ul li li li:hover > ul,
#navigator ul li li li li:hover > ul,
#navigator ul li li li li li:hover > ul{
position: absolute;
z-index: 10;
width: 180px;
line-height: 20px;
display: block;
background: #555;
box-shadow: 0 7px 6px -7px #373435;
-webkit-box-shadow: 0 7px 6px -7px #373435;
-moz-box-shadow: 0 7px 6px -7px #373435;
}
#menu ul ul li ul{
top: 0;
left: 179px;
min-height: 100%;
border-left: 1px solid #444;
}
#menu ul ul li{ /*position: relative;*/ }
#menu ul ul li a{
color: #fefefe;
font-size: 14px;
font-family: 'Open Sans Condensed', sans-serif;
text-transform: uppercase;
display: block;
padding: 12px 7px;
border-top: 1px solid rgba(255,255,255,0.045);
border-bottom: 1px solid rgba(0,0,0,0.045);
text-transform: uppercase;
}
#menu ul ul li:hover > a{ background: #444; }
#menu ul ul li li:hover > a{}
#menu ul ul li li li:hover > a{}
#menu ul ul li li li li:hover > a{}
#menu ul ul li li li li li:hover > a{}
}
@media handheld, screen and (max-width: 640px){
/* [ Open/Close =====================================*/
/* ==================================================*/
.abrir_menu{ display: block; }
.abrir_menu span{
color: #fefefe;
font-size: 20px;
font-family: 'Open Sans Condensed', sans-serif;
text-align: center;
letter-spacing: 5px;
position: absolute;
z-index: 99;
top: 0;
left: 0;
width: 100%;
height: 50px;
line-height: 50px;
margin: 0 auto;
display: block;
cursor: pointer;
background: #333 url() no-repeat 10px center;
box-shadow: 0 7px 3px -7px #373435;
-webkit-box-shadow: 0 7px 3px -7px #373435;
-moz-box-shadow: 0 7px 3px -7px #373435;
}
.open > .abrir_menu{ position: fixed; top: 0; left: 0; width: 100%; height: 100%; display: block; background: rgba(225,225,225,0.85); }
.open > .abrir_menu span{ opacity: 0.1 !important; }
.menu_aberto{
position: fixed;
z-index: 99;
top: 0;
left: -300px;
width: 300px;
height: 100%;
overflow-x: hidden;
overflow-y: scroll;
background: #555;
transition: 0.3s;
box-shadow: -4px 0 15px 0px #373435;
-webkit-box-shadow: -4px 0 15px 0px #373435;
-moz-box-shadow: -4px 0 15px 0px #373435;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
}
.open > .menu_aberto{ left: 0; }
/* Open/Close ] =====================================*/
/* ==================================================*/
/* [ Menu ===========================================*/
/* ==================================================*/
#navigator .title{
color: #666;
font-size: 20px;
font-family: 'Open Sans Condensed', sans-serif;
text-transform: uppercase;
text-shadow: 0.8px 0.8px 3px #111;
height: 60px;
line-height: 62px;
display: block;
padding: 0 20px;
border-bottom: 1px solid rgba(0,0,0,0.045);
background: #333 url() no-repeat 20px center;
box-shadow: -4px 0 5px 0px #373435;
-webkit-box-shadow: -4px 0 5px 0px #373435;
-moz-box-shadow: -4px 0 5px 0px #373435;
}
#navigator ul li > ul,
#navigator ul li li > ul,
#navigator ul li li li > ul,
#navigator ul li li li li > ul,
#navigator ul li li li li li > ul{
position: relative;
width: 100%;
height: 100%;
top: 0;
left: 0;
margin: 0;
padding: 0;
border: none;
background: rgba(0,0,0,0.1);
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
}
#navigator ul li{ float: none; display: block; }
#navigator ul li a{
color: #999;
font-size: 14px;
display: block;
padding: 20px;
border-top: 1px solid rgba(255,255,255,0.045) !important;
border-bottom: 1px solid rgba(0,0,0,0.045) !important;
}
#navigator > ul > li:hover > a{ color: #aaa; background: #444; }
/* Styles (Links/Hover/Ativo Sub Menu) ==============*/
/* ==================================================*/
#navigator > ul > li > .parent,
#navigator > ul > li:hover > .parent,
#navigator > ul > li.hover > .parent,
#navigator ul li li > .parent,
#navigator ul li li:hover > .parent,
#navigator ul li li.hover > .parent{ background-repeat: no-repeat; background-position: 260px center; }
#navigator > ul > li > .parent,
#navigator > ul > li:hover > .parent{ color: #aaa; background-color: inherit; background-image: url(); }
#navigator > ul > li.hover > .parent{ color: #aaa; background-color: #444; background-image: url(); }
/* Styles (Links/Hover/Ativo Sub>Sub Menu) ==========*/
/* ==================================================*/
#navigator ul li li a{ color: #aaa; font-size: 12px; }
#navigator ul li li > .parent,
#navigator ul li li:hover > .parent{ color: #aaa; background-color: inherit; background-image: url(); }
#navigator ul li li.hover > .parent{ color: #aaa; background-color: rgba(0,0,0,0.1); background-image: url(); }
.nav ul{ display: none; left: -9999px; }
.nav li.hover > ul,
.nav li li.hover > ul,
.nav li li li.hover > ul,
.nav li li li li.hover > ul,
.nav li li li li li.hover > ul,
.nav li li li li li li.hover > ul{
position: static !important;
display: block !important;
}
/* Menu ] ===========================================*/
/* ==================================================*/
}
@media handheld, screen and (max-width: 480px){
.open > .menu_aberto{ width: 250px; }
#menu > ul > li > .parent,
#menu > ul > li:hover > .parent,
#menu > ul > li.hover > .parent,
#menu ul li li > .parent,
#menu ul li li:hover > .parent,
#menu ul li li.hover > .parent{ background-repeat: no-repeat; background-position: 210px center; }
}
@media handheld, screen and (max-width: 319px){
.open > .menu_aberto{ width: 200px; }
#menu > ul > li > .parent,
#menu > ul > li:hover > .parent,
#menu > ul > li.hover > .parent,
#menu ul li li > .parent,
#menu ul li li:hover > .parent,
#menu ul li li.hover > .parent{ background-repeat: no-repeat; background-position: 150px center; }
}
jQuery.noConflict();
jQuery(document).ready(function($){
$('.abrir_menu').click(function(){
$("body").toggleClass('no_scroll');
});
});
jQuery.noConflict();
jQuery(document).ready(function($){
$(function() {
initDropDowns($("#menu"));
});
function initDropDowns(allMenus) {
allMenus.children(".abrir_menu").on("click", function() {
var thisTrigger = jQuery(this),
thisMenu = thisTrigger.parent(),
thisPanel = thisTrigger.next();
if(thisMenu.hasClass("open")){
thisMenu.removeClass("open");
jQuery(document).off("click");
thisPanel.off("click");
}
else{
allMenus.removeClass("open");
thisMenu.addClass("open");
jQuery(document).on("click", function() {
allMenus.removeClass("open");
});
thisPanel.on("click", function(e) {
e.stopPropagation();
});
}
return false;
});
}
});
jQuery(document).ready(function($){
$(".menu_aberto").on("click", function(){
if($(this).has){
$("body").removeClass("no_scroll");
}
});
});
jQuery.noConflict();
jQuery(document).ready(function($){
$(document).ready(function() {
$(".nav li a").each(function() {
if ($(this).next().length > 0) {
$(this).addClass("parent");
};
})
})
$(function(){
$(".nav li").unbind('mouseenter mouseleave');
$(".nav li a.parent").unbind('click').bind('click', function(e){
$(this).parent("li").toggleClass("hover");
e.preventDefault();
});
});
});
Also see: Tab Triggers