HI,
Yes you can extend the last item to the end of the bar quite easily. You just have to un-float it and then set overflow:hidden which will allow it to fill the remaining space.
Code:
#wrap nav li.last{
float:none;
overflow:hidden;
zoom:1.0;
}
Code:
<li class="last"><a href="#">Contact Us</a></li>
Full code:
Code:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<link href="css/demo.css" rel="stylesheet" type="text/css">
<style>
@charset "UTF-8";
/* HTML5 */
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
display:block;
}
/* GENERIC ELEMENTS */
body {
margin: 0;
}
ul {
padding:0;
margin:0;
}
/* BASICS */
#wrap {
width: 960px;
margin-right: auto;
margin-left: auto;
}
#wrap nav {
margin-bottom: 10px;
height: 40px;
line-height: 40px;
border: 1px solid #cccccc;
background-color: #CCC;
}
#wrap nav ul li {
float: left;
list-style-type: none;
}
#wrap nav ul li a {
display: block;
padding-left: 20px;
padding-right: 20px;
color: #666666;
text-decoration: none;
}
#wrap nav ul li a:hover {
color: #FFF;
background-color: #C30;
}
#wrap nav li.last{
float:none;
overflow:hidden;
zoom:1.0;
}
</style>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div id="wrap">
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About Us</a></li>
<li><a href="#">Corporate</a></li>
<li><a href="#">Personal</a></li>
<li><a href="#">Not-For-Profit</a></li>
<li><a href="#">Business Advisory</a></li>
<li><a href="#">Ask Us A Question</a></li>
<li class="last"><a href="#">Contact Us</a></li>
</ul>
</nav>
</div>
</body>
</html>
(See how html5 leads to code bloat. You have three wrappers for that list and all you really need is the parent ul - the others are superfluous as far as styling is concerned.)
Bookmarks