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:
<body>
<div class="tile_div">
<table class="tile_table">
<tr>
<td>
<img class="tile_image" height="50px" width="100px" src="./images/button_left.png"/>
<p class="tile_p">Button one</p>
</td>
<td>
<img class="tile_image" height="50px" width="100px" src="./images/button_left.png"/>
<p class="tile_p">Button two</p>
</td>
<td>
<img class="tile_image" height="50px" width="100px" src="./images/button_left.png"/>
<p class="tile_p">Button three</p>
</td>
</tr>
</table>
</div>
</body>
CSS:
.tile_image {
float: left;
margin: 0px;
}
.tile_image img {
position:absolute;
}
.tile_p {
text-align:center;
position:relative;
}
How it looks like: http://img580.imageshack.us/img580/8867/uo7i.png
I want the text to be in the middle of the buttons not below them.
EDIT:
Alright so when I use
src="./images/button_left.png"
the image looks they way it should look:
http://img580.imageshack.us/img580/8867/uo7i.png
But when ever I use background-image This happens: http://img580.imageshack.us/img580/6127/yz4.png
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With