0

I have searched every where for an answer as to how to align my home, contact etc. buttons centered across the bottom of my xhtml page, I have tried everything I have found but I just can not do it :( I have tried setting up a CSS code, html code everything, nothing works.

4

1 回答 1

0

这是一个允许块元素居中的简单设置(演示):

HTML

<div id="footer">
    <ul>
        <li><a href="#">Item One</a></li>
        <li><a href="#">Item Two</a></li>
        <li><a href="#">Item Three</a></li>
        <li><a href="#">Item Four</a></li>
        <li><a href="#">Item Five</a></li>
    </ul>
</div>

CSS

#footer {
    text-align: center;
}

ul {
    display: inline-block;
    margin: 0 auto;
    padding: 0;
}

ul li {
    background: #eee;
    display: block;
    float: left;
    list-style: none;
    margin: 0 3px;
    padding: 0 10px;
}

/* Add this conditionally for less than IE7 inline-block support
ul {
    display: inline;
    zoom: l;
}
/*
于 2012-08-05T05:59:41.307 回答