CSS: I can't put a button in the middle of a DIV element

Viewed 54159

I'm using CSS buttons from this tutorial:

http://www.oscaralexander.com/tutorials/how-to-make-sexy-buttons-with-css.html

I need to put a button in the middle of a DIV so it's centered. But I can't!

Here's the code of the button:

<a class="button" href="#"><span>Bring world peace</span></a>  

And here's CSS:

.clear { /* generic container (i.e. div) for floating buttons */
    overflow: hidden;
    width: 100%;
}

a.button {
    background: transparent url('bg_button_a.gif') no-repeat scroll top right;
    color: #444;
    display: block;
    float: left;
    font: normal 12px arial, sans-serif;
    height: 24px;
    margin-right: 6px;
    padding-right: 18px; /* sliding doors padding */
    text-decoration: none;
}

a.button span {
    background: transparent url('bg_button_span.gif') no-repeat;
    display: block;
    line-height: 14px;
    padding: 5px 0 5px 18px;
} 

Here's the code I'm trying to use:

<div align="center"><a class="button" href="#"><span>Bring world peace</span></a></div>
3 Answers
Related