Stressed worker worried about getting home to see her family

What are nav bars?

Think about it: your navigation is actually an unordered list of links.

Mark them up inside <ul> tags.

Horizontal Nav bars

We can use CSS to control how these lists are displayed on our pages.

By using display:inline we can create horizontal nav bars.

Here’s the code used for this nav bar:

#nav1{
margin-top:1em;
margin-bottom:0.5em;
}

#nav1 ul{
background-color:silver;
text-align:center;
margin-left:0;
padding-left:0;
border-bottom:1px solid gray
}

#nav1 li{
list-style-type:none;
padding:0.25em 1em;
border-left:1px solid white;
display: inline
}

#nav1 li:first-child{
border:none;
}

Vertical Navbars

Here’s the code for this one:

#nav2 {
background-color:silver;
border:solid 1px gray;
width: 8em
}

#nav2 ul{
list-style-type:none;
margin:0;
padding:0;
border:none
}

#nav2 li{
margin:0;
padding:0.25em 0.5em 0.25em 1em;
border-top:1px solid gray;
width: 100%;
display: block
}

html>body #nav2 li{
width: auto;
}

#nav2 li:first-child{
border:none
}

For more information, see Mark Newhouse’s article, Taming lists, at A List Apart, and "Styling lists" at the CSS-Discuss wiki .

Scott Design