Stretch horizontal ul to fit width of div

This is the easiest way to do it:

(or with table-layout: fixed for even width distribution:

This won’t work in IE7.

#horizontal-style {
    display: table;
    width: 100%;
    /*table-layout: fixed;*/
#horizontal-style li {
    display: table-cell;
#horizontal-style a {
    display: block;
    border: 1px solid red;
    text-align: center;
    margin: 0 5px;
    background: #999;

Old answer before your edit:

Leave a Comment