Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

css positioning baseline

I would like to have the dropdown at the same baseline level of Btn1-2 and Btn3 above, but within the cell. Basically the opposite as what it is now. What am I missing? Thanks

<table style="width:100%">
    <tr style="border:1px solid #000">
        <td>
            <div style="position:relative">
            <input type="button" value="Bt1" /> 
            <input type="button" value="Bt2" /> 
                <div style="position:absolute; top:0; right:0;">
                    <input type="button" value="Btn3" /> <br />
                    <select>
                        <option>Hello</option>
                    </select>
                </div>
            </div>
        </td>
    </tr>
</table>
like image 426
JoshD Avatar asked Jun 10 '26 14:06

JoshD


1 Answers

That's how you should do this:

<table style="width:100%">
    <tr style="border:1px solid #000">
        <td>
            <div style="float:left;">
            <input type="button" value="Bt1" /> 
            <input type="button" value="Bt2" /> 
            </div>
            <div style="float:right;">
            <input type="button" value="Btn3" />                    
                   <select>
                        <option>Hello</option>
                    </select>
            </div>
        </td>
    </tr>
</table>

Set float for the two divs. Here is the demo: http://jsfiddle.net/naveed_ahmad/DnWWy/

like image 77
Naveed Ahmad Avatar answered Jun 12 '26 10:06

Naveed Ahmad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!