I have been trying everything to center the content with in a container but it just does not work! The ideia is to have a button with variable width depending on the text i'll have on it. I already know if you use fixed width this can be done. I have also managed to center the container div. The code is to follow:
<<CSS>>
#button-next {
display: block;
padding: 0;
border: 0;
width: auto; /* This could also be fixed */
margin: 20px auto 0 auto;
background: #f5f5f5;
height: 47px;
text-align: center;
}
#button-next-left {
margin-left: auto;
float:left;
height: 47px;
width: 12px;
background-image: url('img/button-next-left.jpg');
background-repeat: no-repeat;
background-position: 0px 0px;
background-color: #f5f5f5;
}
#button-next-right {
margin-left: auto;
text-align:center;
height: 47px;
width: 48px;
float:left;
background-image: url('img/button-next-right.jpg');
background-repeat: no-repeat;
background-position: 0px 0px;
background-color: #f5f5f5;
}
#button-next-text {
text-align:center;
padding: 0px 5px 0 5px;
float:left;
height: 47px;
background-image: url('img/button-next-bg.jpg');
background-repeat: repeat;
background-color: #f5f5f5;
}
<<XHTML>>
<div id="button-next">
<div id="button-next-left">
</div>
<div id="button-next-text">
<a href="can-you-help-me.php" class="button-next-link">Can you help me?</a></div>
<div id="button-next-right">
<img src="img/button-next-right.jpg" border="0" />
</div>
</div>
Thanks!!





Reply With Quote


Bookmarks