Skip to content Skip to sidebar Skip to footer

Align Right Side Of Button And Input

I have a text input field and 2 buttons on the next line within a dialog box. How may I line up the input field in the center of the dialog and align the buttons to the right hand

Solution 1:

CSS:

.container {
    display: inline-block;
}

input.text {
    width: 150px;
    display: block;
}

.right {
    float: right;
}

HTML:

<div class="container" >
    <input type="text" class="text" />
    <span class="right">
        <input type="button" value="button" />
        <input type="button" value="button" />
    </span>
</div>

Working example: http://jsfiddle.net/GTTFY/


Solution 2:

<style>

.container
{
    margin-left:auto;
    margin-right:auto;
    width:150px;
    }

</style>


<div class="container" >

<input name="" type="text" class="textbox" id="textbox" />
<input name="" type="button" style="float:right;" value="Button"/> 
<input name="" type="button" style="float:right;" value="Button"/> 

</div>

Solution 3:

<style>

.test
{
    margin-left:auto;
    margin-right:auto;

}
.test td
{
    float:right;
}
</style>

<table class="test">
    <tr>
        <td colspan=2><input name="" type="text" class="textbox" id="textbox" /></td>
    </tr>
    <tr>
        <td><input name="" type="button" value="Button"/> </td>
        <td><input name="" type="button" value="Button"/> </td>
    </tr>
</table>

Post a Comment for "Align Right Side Of Button And Input"