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.
<article class="main">
<div class="row">
<h1>Foundation 6 Menu Examples<h1>
<h3 class="subheader">Showcasing how to use the revised menus</h3>
<p>Foundation 6 added an optional library to allow developers to take advantage of flexible animations and transitions for their designs. This example will feature a few to show you what's possible.</p>
<p><a href="https://foundation.zurb.com/sites/docs/menu.html" target="_blank" title="Foundation 6 Menu Docs">Take a look at the docs here</a> for additional information and settings.</p>
<h3>Basic Menu</h3>
<p>The basic menu is a standard horizontal menu with default styles for the menu, li and a elements.</p>
<ul class="menu">
<li><a href="#">Monday</a></li>
<li><a href="#">Tuesday</a></li>
<li><a href="#">Wednesday</a></li>
<li><a href="#">Thursday</a></li>
<li><a href="#">Friday</a></li>
</ul>
<h3>Vertical Menu</h3>
<p>By adding the <code>.vertical</code> class to the <code>ul</code> element you can make this a vertical menu (good for sidebars).</p>
<ul class="menu vertical">
<li><a href="#">Accounting</a></li>
<li><a href="#">I.T</a></li>
<li><a href="#">Law</a></li>
<li><a href="#">Medicine</a></li>
</ul>
<h3>Nested Menu</h3>
<p>You can nest your menu inside another menu with the addition of the <code>nested</code> class. It adds an offset so you can easily see child elements.</p>
<ul class="menu vertical">
<li><a href="#">Course One</a>
<ul class="menu vertical nested">
<li><a href="#">Course One - One</a></li>
<li><a href="#">Course One - Two</a></li>
</ul>
</li>
<li><a href="#">Course Two</a></li>
</ul>
<p>This really only makes sense when you are using vertical menus (else you get a strange padded-out horizontal layout).</p>
<h3>Breadcrumbs</h3>
<p>Technically not an actual menu, but still pretty useful. You need to add the <code>breadcrumb</code> class to a <code>ul</code> and the framework will take care of the rest.</p>
<p>You can set the current item to be disabled by adding the <code>disabled</code> class to it and not using an <code>a</code> element</p>
<a class="button" href="https://foundation.zurb.com/sites/docs/breadcrumbs.html" target="_blank">Read the breadcrumb documentation</a>
<ul class="breadcrumbs">
<li><a href="#">Computer Hardware</a></li>
<li><a href="#">Processors</a></li>
<li><a href="#">Intel</a></li>
<li class="disabled">Core i7</li>
</ul>
<h3>Icon Menus</h3>
<p>You can add icons to your menu to create a social media menu or action bar. This is done by adding your icon between the <code>a</code> tag before the text for each menu item.</p>
<ul class="menu">
<li><a href="#"><i class="fi-shopping-cart"></i><span>One</span></a></li>
<li><a href="#"><i class="fi-results"></i> <span>Two</span></a></li>
<li><a href="#"><i class="fi-power"></i> <span>Three</span></a></li>
<li><a href="#"><i class="fi-magnifying-glass"></i> <span>Four</span></a></li>
</ul>
<h3>Dropdown Menu</h3>
<p>The dropdown menu works like a traditional menu but supported child elements that are shown on hover. You specifty this menu to be a dropdown by adding the data-attribute <code>data-dropdown-menu</code> to the menu <code>ul</code></p>
<p><a href="https://foundation.zurb.com/sites/docs/dropdown-menu.html" class="button">Read the dropdown documentation</a></p>
<ul class="menu dropdown" data-dropdown-menu>
<li><a href="#">Home</a></li>
<li><a href="#">About Us</a>
<ul class="menu">
<li><a href="#">Our Values</a></li>
<li><a href="#">Our ideals</a></li>
</ul>
</li>
<li><a href="#">Services</a>
<ul class="menu">
<li><a href="#">Consultancy</a></li>
<li><a href="#">Accounting</a></li>
<li><a href="#">Dynamics</a></li>
</ul>
</li>
<li><a href="#">Contact</a></li>
</ul>
<h3>Drilldown Menu</h3>
<p>This menu is best used in vertical menus (and on smaller screen sizes). It displays your menu items normally, but anything with a sub-menu will have a right facing arrow. Clicking on this arrows will push the menu to the left and bring to focus the new sub-menu.</p>
<p>These menus all have a back button, letting you move forward and backwards through deep menus without using any more physical space.</p>
<p><a href="https://foundation.zurb.com/sites/docs/responsive-navigation.html#" class="button">Read the drilldown documentation</a></p>
<ul class="menu vertical" data-drilldown>
<li><a href="#">Home</a></li>
<li><a href="#">Summer Classes</a>
<ul class="menu vertical">
<li><a href="#">Chemisty</a></li>
<li><a href="#">Physics</a>
<ul class="menu vertical">
<li><a href="#">Introduction to Physics </a></li>
</ul>
</li>
<li><a href="#">Computing</a>
<ul class="menu vertical">
<li><a href="#">Programming Fundamentals</a></li>
<li><a href="#">Introduction to Networking</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#">Winter Classes</a>
<ul class="menu vertical">
<li><a href="#">Chemisty</a>
<ul class="menu vertical">
<li><a href="#">How things are made - an introduction</a></li>
<li><a href="#">Advanced Explosions</a></li>
</ul>
</li>
<li><a href="#">Physics</a>
<ul class="menu vertical">
<li><a href="#">Advanced Physics </a></li>
</ul>
</li>
<li><a href="#">Computing</a>
<ul class="menu vertical">
<li><a href="#">Networking Core Concepts</a></li>
<li><a href="#">Software Development</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#">Contact Us</a></li>
</ul>
<h3>Top Menu</h3>
<p>The top menu has also been adjusted in Foundation 6. You can still use it like you did before. You can supply a 'top-bar-left' class and a 'top-bar-right' class to create two distinct areas</p>
<p>In addition, you can also use the 'title-bar' functionaliy from the <a hhref="https://foundation.zurb.com/sites/docs/responsive-navigation.html#responsive-toggle">'responsive toggle'</a> component. This will let you show a toggle menu only on small devices and when connected to your menu, it will show or hide it.</p>
<div class="title-bar" data-responsive-toggle="top-menu">
<button class="menu-icon" type="button" data-toggle></button>
<div class="title-bar-title">Menu</div>
</div>
<div class="top-bar" id="top-menu">
<div class="top-bar-left">
<ul class="dropdown vertical medium-horizontal menu">
<li><a href="#">Monday</a></li>
<li><a href="#">Tuesday</a></li>
<li><a href="#">Wednesday</a></li>
<li><a href="#">Thursday</a></li>
<li><a href="#">Friday</a></li>
</ul>
</div>
<div class="top-bar-right">
<ul class="dropdown vertical medium-horizontal menu">
<li><a href="#">january</a></li>
<li><a href="#">February</a></li>
<li><a href="#">March</a></li>
<li><input type="search" placeholder="Search"></li>
</ul>
</div>
</div>
</div>
</article>
.main {
padding: 10px 0px 80px 0px;
}
h3 {
margin-top: 15px;
}
.row {
padding-left: 15px;
padding-right: 15px;
}
.menu {
background: #eee;
}
/* some drilldown styling */
.is-drilldown {
width: auto !important;
}
$(document).foundation();
// Menu links disabled just for demo purposes
$('.menu a').on('click', function (e) {
e.preventDefault();
});
Also see: Tab Triggers