views:

76

answers:

1

I don't know the rendered width of DIV or any of the buttons. How do I change the markup such that the buttons are rendered with a uniform (or as close as can be) distance between each of them?

EDIT: Also, the buttons should consume the full width of the DIV.

<div>
    <asp:Button ID="Button1" runat="server" Text="Action1" />
    <!-- space between rendered buttons -->
    <asp:Button ID="Button2" runat="server" Text="Action2" />
    <!-- space between rendered buttons -->
    <asp:Button ID="Button3" runat="server" Text="Action3" />
    <!-- space between rendered buttons -->
    <asp:Button ID="Button4" runat="server" Text="Action4" />
</div>
A: 

I am thinking this can't be done without a table, JavaScript or the use of at least some (relative) widths (if you can set percentages, it's easy.).

Or maybe putting each button into a div with display: table-cell, but I find that sick. Then rather be honest and use a table.

Feel free to prove me wrong, I'd be interested in alternative approaches myself.

Pekka
Marking this as the answer for now. Here's to someone coming along later and offering us both an alternative.
lance