A Tab Menu with pointer

Pre 2006

copyright © stu nicholls - CSS play

Information

An unordered list styled to give a horizontal tabbed list with a central pointer under each link on hover. Works in IE5.5, IE6, Firefox, Opera 8, Mozilla and NN 8. Doesn't work in Mac IE5 (why am I not suprised anymore . . . ho hum).

This menu does not use any images, will resize to fit any link text and will keep the pointer centrally positioned. It was produced whilst helping Sven Glazenburg with his menu problem.

Cascading Style Sheet

.menu {
  padding:0; 
  margin:0; 
  list-style-type:none;
  white-space:nowrap;
  }
.menu li {
  float:left;
  min-width:100px;
  }
.menu a {
  position:relative;
  display:block; 
  text-decoration:none; 
  min-width:100px; 
  float:left; 
  }
* html .menu a {
  width:100px;
  }
.menu a span {
  display:block; 
  color:#000; 
  background:#c4c4c4; 
  border:1px solid #fff; 
  border-width:2px 1px; 
  text-align:center; 
  padding:4px 16px; 
  cursor:pointer;
  }
* html .menu a span {
  width:100px; 
  cursor:hand; 
  w\idth:66px;
  }
.menu a b {
  display:block; 
  border-bottom:2px solid #06a;
  }
.menu a em {
  display:none;
  }
.menu a:hover {
  background:#fff;
  }
.menu a:hover span {
  color:#fff; 
  background:#08c;
  }
.menu a:hover em {
  display:block; 
  overflow:hidden; 
  border:6px solid #06a; 
  border-color:#06a #fff; 
  border-width:6px 6px 0 6px; 
  position:absolute; 
  left:50%; 
  margin-left:-6px;
  }

xhtml

<ul class="menu">
  <li>
    <a href="#nogo">
      <b><span>Tab One</span></b><em></em>
    </a>
  </li>
  <li>
    <a href="#nogo">
      <b><span>Tab Two</span></b><em></em>
    </a>
  </li>
  <li>
    <a href="#nogo">
      <b><span>Tab Three: Long Tab!!</span></b><em></em>
    </a>
  </li>
  <li>
    <a href="#nogo">
      <b><span>Tab Four</span></b><em></em>
    </a>
  </li>
</ul>

Copyright

You may use this method on your personal 'non-profit' web site without seeking my permission. A link back to CSSplay is always appreciated.

Commercial usage is also permitted without seeking approval, but I would ask that a donation is considered to support my work on CSSPlay.

If you are having problems integrating any of my demonstrations into your website then I now offer a service to fault find and correct any errors that you may have introduced. Please email me for more information.



Please Support CSS play

Please note that if your donation is for a demo/menu then you will need to email me with the url of the demo/menu after making the donation

For more CSS demonstrations I recommend that you visit the Dynamic Drive CSS Library.


Free, practical CSS menus, layouts, and examples

Follow CSS play


Facebook   Twitter   Facebook Fan Page