3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

JavaScript/CSS Tab Menu with Sub-Navigation

Step 2The HTML Mark-Up

Our markup for the menu is fairly straightforward. We're going to create a container div that will hold an unordered list containing our main menu items. Below that, we'll make another container div and within it, we'll put unordered lists for each sub-menu.

Like so:
[nav]  [main menu]  [sub-nav]    [sub-nav menus]  [/sub-nav][/nav]

So let's build the mark-up....

Our document head (where we import our JavaScript and CSS):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head>	<title>Javascript & CSS Tab Menu with Sub-navigation</title>	<style type="text/css">		@import "css/menu.css";	</style>	<script type="text/javascript" src="js/menu.js"></script></head>

The body tag, wherein we initialize the menu (IMPORTANT):
<body onload="navMenu()">

The menus themselves (structured as illustrated above):
<div id="nav">	<ul id="tabBar">		<li><a href="/index.html">Home</a></li>		<li><a href="/about.html" rel="menutrigger" name="about">About</a></li>		<li><a href="/work.html" rel="menutrigger" name="work">Our Work</a></li>		<li><a href="/contact.html">Contact</a></li>	</ul>	<div id="subNav">		<ul id="aboutNav">			<li><a href="/staff.html">Our Staff</a></li>			<li><a href="/facilities.html">Facilities</a></li>			<li><a href="/certifications.html">Certifications</a></li>		</ul>		<ul id="workNav">			<li><a href="/programs.html">Programs</a></li>			<li><a href="/events.html">Events</a></li>		</ul>	</div></div>

Close the body and the rest of the page as well:
</body></html>	
« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
12
Followers
3
Author:KelliShaver