Hi,
I would just use display:table-cell without any widths and let the cells space themselves out. It will be close enough not to worry about.
e.g.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<style type="text/css">
ul.nav2 {
list-style:none;
background:#000;
color:#fff;
margin:0 auto;
width:80%;
display:table;
}
.nav2 li {
display:table-cell;
padding:5px;
text-align:center
}
.nav2 a {
display:block;
color:#fff;
text-decoration:none;
text-transform:uppercase;
}
/* second example below */
</style>
</head>
<body>
<ul class="nav2">
<li><a href="#">Home</a></li>
<li><a href="#">Collections</a></li>
<li><a href="#">About Us</a></li>
<li><a href="#">Stockists</a></li>
<li><a href="#">Trade Enquiries</a></li>
<li><a href="#">Press</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
</body>
</html>
There is a trick you can use using text-align justify to space elements equally but it needs some setting up.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Distributed Horizontal Menu</title>
<meta name="generator" content="PSPad editor, www.pspad.com">
<style type="text/css">
.nav {
margin:auto;
list-style:none;
padding:0 10px;
min-width:40em;
width:80%;
overflow:hidden;
text-align:justify;
background:#000;
color:#fff;
font-size:80%;
line-height:3em;
height:3em;
}
.nav li { display:inline; }
.nav li.last { margin-right:100%; }
.nav li a {
display:inline-block;
line-height:3em;
vertical-align:middle;
text-decoration:none;
text-transform:uppercase;
color:#fff;
}
</style>
</head>
<body>
<ul class="nav">
<li><a href="#">Home</a></li>
<li><a href="#">Collections</a></li>
<li><a href="#">About Us</a></li>
<li><a href="#">Stockists</a></li>
<li><a href="#">Trade Enquiries</a></li>
<li><a href="#">Press</a></li>
<li class="last"><a href="#">Contact Us</a> </li>
<!-- the last non breaking space is needed for the justify effect -->
</ul>
</body>
</html>
Bookmarks