html - Align buttons in For Loop -
html - Align buttons in For Loop -
this html code @ moment:
<title>cashier/customer application</title> </head> <body> <h1>cashier/customer application</h1> <div id="createorderdiv"> <input id="createorderbutton" type="button" value="new order" onclick="showorderoptions();"/> </div> <div id="createordertable" style="display:none;"> <form action='controller' method='post'> <table> <tr> <td>coffee type:</td> <td> <select name="ordertype" id="coffeetype"> <option value="espresso">espresso</option> <option value="macchiato">macchiato</option> <option value="cappuccino">cappuccino</option> </select> </td> </tr> <tr> <td>addition type:</td> <td> <select name="orderaddition" id="additiontype"> <option value="skimmilk">skim milk</option> <option value="extrashot">extra shot</option> </select> </td> </tr> <tr> <td><input name="submitorderbtn" type="submit" value="submit order" onclick="changegetorderid(this.id)"/></td> </tr> </table> </form> </div> <h2>open orders</h2> <div id="openordertable"> <form action='controller' method='post'> <table> <c:foreach var="item" items="${openorders}"> <tr style="text-align:center;"> <td><input name="button${item.id}" id="order:${item.id}" type="submit" value="- coffee order ${item.id}" onclick="changegetorderid(this.id)"/></td> </tr> <tr style="text-align:center;"> <td><input name="button${item.id}" id="cancel:${item.id}" type="submit" value="cancel" onclick="changegetorderid(this.id)"/></td> </tr> <tr style="text-align:center;"> <td><input name="button${item.id}" id="update:${item.id}" type="submit" value="update" onclick="changegetorderid(this.id)"/></td> </tr> <tr style="text-align:center;"> <td> <select name="updatetype${item.id}"> <option value="cappuccino">cappuccino</option> <option value="espresso">espresso</option> <option value="macchiato">macchiato</option> </select> </td> <td> <select name="updateaddition${item.id}"> <option value="">none</option> <option value="skimmilk">skim milk</option> <option value="extrashot">extra shot</option> </select> </td> <tr style="text-align:center;"> <tr style="text-align:center;"> <td><input name="button${item.id}" id="pay:${item.id}" type="submit" value="pay" onclick="changegetorderid(this.id)"/></td> </tr> <tr style="text-align:center;"> <td> <select name="paymenttype${item.id}"> <option value="cash">cash</option> <option value="card">card</option> </select> </td> <td> name: <input type="text" name="name${item.id}"><br> </td> <td> card no: <input type="text" name="cardno${item.id}"><br> </td> <td> expires: <input type="text" name="expires${item.id}"><br> </td> </tr> <tr style="text-align:center;"> <td><input name="button${item.id}" id="option:${item.id}" type="submit" value="option" onclick="changegetorderid(this.id)"/></td> </tr> </c:foreach> </table> <input type="hidden" name="orderid" id="orderid" value=""> <h2>cancelled orders</h2> <table> <c:foreach var="item" items="${cancelledorders}"> <tr style="text-align:center;"> <td><input name="button${item.id}" id="order:${item.id}" type="submit" value="- coffee order ${item.id}" onclick="changegetorderid(this.id)"/></td> </tr> </c:foreach> </table> </form> </div> <h2>result</h2> </body> </html>
this css:
@charset "iso-8859-1"; h1,h2 { text-align:center; } #createorderdiv { text-align:center; } #createordertable{ text-align:center; } table { width: 700px; margin-left: auto; margin-right: auto; } body{ font-family: verdana, arial, sans-serif; width: 900px; margin-left: auto; margin-right: auto; border: 1px solid; padding: 20px; }
this producing following:
i trying buttons , drop downwards boxes aligned in center how cancelled orders
, button
below aligned.
would have tips go achieving this?
thanks help.
simply add together css below stylesheet:
tr td { display: block; }
class="snippet-code-css lang-css prettyprint-override">h1, h2 { text-align: center; } #createorderdiv { text-align: center; } #createordertable { text-align: center; } table { width: 700px; margin-left: auto; margin-right: auto; } body { font-family: verdana, arial, sans-serif; width: 900px; margin-left: auto; margin-right: auto; border: 1px solid; padding: 20px; } tr td { display: block; }
class="snippet-code-html lang-html prettyprint-override"><h1>cashier/customer application</h1> <div id="createorderdiv"> <input id="createorderbutton" type="button" value="new order" onclick="showorderoptions();" /> </div> <div id="createordertable" style="display:none;"> <form action='controller' method='post'> <table> <tr> <td>coffee type:</td> <td> <select name="ordertype" id="coffeetype"> <option value="espresso">espresso</option> <option value="macchiato">macchiato</option> <option value="cappuccino">cappuccino</option> </select> </td> </tr> <tr> <td>addition type:</td> <td> <select name="orderaddition" id="additiontype"> <option value="skimmilk">skim milk</option> <option value="extrashot">extra shot</option> </select> </td> </tr> <tr> <td> <input name="submitorderbtn" type="submit" value="submit order" onclick="changegetorderid(this.id)" /> </td> </tr> </table> </form> </div> <h2>open orders</h2> <div id="openordertable"> <form action='controller' method='post'> <table> <c:foreach var="item" items="${openorders}"> <tr style="text-align:center;"> <td> <input name="button${item.id}" id="order:${item.id}" type="submit" value="- coffee order ${item.id}" onclick="changegetorderid(this.id)" /> </td> </tr> <tr style="text-align:center;"> <td> <input name="button${item.id}" id="cancel:${item.id}" type="submit" value="cancel" onclick="changegetorderid(this.id)" /> </td> </tr> <tr style="text-align:center;"> <td> <input name="button${item.id}" id="update:${item.id}" type="submit" value="update" onclick="changegetorderid(this.id)" /> </td> </tr> <tr style="text-align:center;"> <td> <select name="updatetype${item.id}"> <option value="cappuccino">cappuccino</option> <option value="espresso">espresso</option> <option value="macchiato">macchiato</option> </select> </td> <td> <select name="updateaddition${item.id}"> <option value="">none</option> <option value="skimmilk">skim milk</option> <option value="extrashot">extra shot</option> </select> </td> <tr style="text-align:center;"> <tr style="text-align:center;"> <td> <input name="button${item.id}" id="pay:${item.id}" type="submit" value="pay" onclick="changegetorderid(this.id)" /> </td> </tr> <tr style="text-align:center;"> <td> <select name="paymenttype${item.id}"> <option value="cash">cash</option> <option value="card">card</option> </select> </td> <td> name: <input type="text" name="name${item.id}"> <br> </td> <td> card no: <input type="text" name="cardno${item.id}"> <br> </td> <td> expires: <input type="text" name="expires${item.id}"> <br> </td> </tr> <tr style="text-align:center;"> <td> <input name="button${item.id}" id="option:${item.id}" type="submit" value="option" onclick="changegetorderid(this.id)" /> </td> </tr> </c:foreach> </table> <input type="hidden" name="orderid" id="orderid" value=""> <h2>cancelled orders</h2> <table> <c:foreach var="item" items="${cancelledorders}"> <tr style="text-align:center;"> <td> <input name="button${item.id}" id="order:${item.id}" type="submit" value="- coffee order ${item.id}" onclick="changegetorderid(this.id)" /> </td> </tr> </c:foreach> </table> </form> </div>
html css alignment
Comments
Post a Comment