HorizontalNav is a jQuery plugin that spans a horizontal navigation to fit the full width of it's container. If you've ever had to create this effect on a project, you'll know it's pretty annoying to do. But this plugin makes it easy and adds support for IE7.

Example One

This is an example so you can see the difference between a horizontal navigation with no fixed widths and then with a navigation that has the plugin applied to it. There are no requirements to how you style the navigation and adding padding, margins or borders to any of the elements won’t break the effect.

Navigation with horizontalNav disabled

Navigation with horizontalNav enabled

// When document is ready...
$(document).ready(function() {
  // Call horizontalNav on the navigations wrapping element
<nav class="horizontal-nav full-width horizontalNav-notprocessed">
    <li><a href="#">Navigation Item</a></li>
    <li><a href="#">Work</a></li>
    <li><a href="#">Blog</a></li>
    <li><a href="#">About</a></li>
    <li><a href="#">Contact</a></li>
// There is no required CSS for this plugin to work properly
// but here is what is being used to style this demo
.horizontal-nav {
  background: #efefef;
  border-radius: 6px;
.horizontal-nav ul {
  background: #128F9A;
  float: left;
  text-align: center;
  border-radius: 6px;
  border: 1px solid #0e7079;
.horizontal-nav ul li {
  float: left;
  border-left: 1px solid #0e7079;
.horizontal-nav ul li:first-child {
  border-left: 0 none;
.horizontal-nav ul li a {
  display: block;
  padding: 10px 20px;
  color: #fff;
  border-top: 1px solid rgba(255,255,255, 0.25);
  border-left: 1px solid rgba(255,255,255, 0.25);
.horizontal-nav ul li:first-child a {
  border-left: 0 none;
.horizontal-nav ul li a:hover {
  background: #12808a;
.horizontal-nav ul li:first-child a {
  border-top-left-radius: 6px;
  border-bottom-left-radius: 6px;
.horizontal-nav ul li:last-child a {
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;

Available Options

Key Default value Description
responsive true This option will allow the navigation to auto adjust when the window is resized.
responsiveDelay 100 The amount of time to wait before re-adjusting the navigation on window resize. Value is set in milliseconds.
tableDisplay true Enables modern browsers to use display: table or set to false to manually calculate the widths of list items.
minimumItems 0 The minimum number of menu items required before auto adjusting the widths. 0 = always. Useful to prevent one or two items being huge.


If you add the horizontalNav-notprocessed class to your HTML menu then this class will be removed when HorizontalNav runs and a horizontalNav-processed class will be added.

This provides an excellent fallback if HorizontalNav does not run either because of JavaScript being disabled or minimumItems being set and allows you to style your menu items manually under these conditions using the horizontalNav-notprocessed class.