<ul id="menu" class="clearfix">
<li><a href="#">Home</a></li>
<li><a href="#">Buying Property</a></li>
<li><a href="#">Selling Property</a></li>
<li><a href="#">Community Info</a></li>
</ul>
CSS
ul#menu {
list-style-type: none;
}
ul#menu li {
float: left;
margin-right: 1em;
display: block;
}
ul#menu li a {
padding: .2em;
background: #CCC;
}
.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
* html .clearfix { zoom: 1; }
*:first-child+html .clearfix { zoom: 1; }
EDIT:
CSS-, PHP:
$pages = array('Page 1' => 'page1.php', 'Page 2' => 'page2.php');
$numPages = count($pages);
$width = ceil(99/$numPages);
foreach($pages as $title => $link){
echo '<li style="width: ' . $width . '"><a href="' . $link . '">' . $title . '</a></li>';
}
source
share