Skip to content Skip to sidebar Skip to footer

Aligning Buttons In CSS/HTML In One Line Horizontally W/ Text?

I would like to know how could I align my buttons horizontally? On top of that I want to add text to those buttons. This is what I currently have. HTML body part:

Solution 1:

tables should not be used for layout. I think the best approach would be to use floated links like this:

<div class="tile_div">
    <a href="#">Button one</a>
    <a href="#">Button two</a>
    <a href="#" class="last">Button three</a>
    <div class="clear"></div>
</div>

CSS:

.tile_div a {
    display: block;
    float: left;
    height: 50px;
    width: 100px;
    margin-right: 5px;
    background-image: url(./images/button_left.png);
    text-align: center;
    line-height: 50px;
    text-decoration: none;
}

.title_div a.last {
    margin-right: 0;
}

.clear {
    clear: both;
}

JSFiddle


Post a Comment for "Aligning Buttons In CSS/HTML In One Line Horizontally W/ Text?"