freelance84 Posted April 29, 2010 Share Posted April 29, 2010 Hello, I have a problem with tables cells containing form buttons: <tr> <td colspan="2" align="center"> <button id="button-submit_2" type="submit">Add Name</button> </form> <form action="nrt-home-edit&delete.php" method="post"> <input type="hidden" name="class_name" value="$class_name[0]"/> <button id="button-submit_2" type="submit">Finish</button></form> </td> </tr> The above code puts the two buttons on their own lines within the table cell. My question is, does anybody know how to keep them on the same line without putting them into their own individual cells? Quote Link to comment Share on other sites More sharing options...
F1Fan Posted April 29, 2010 Share Posted April 29, 2010 Do this to your <td>: <td colspan="2" align="center" nowrap="nowrap"> Quote Link to comment Share on other sites More sharing options...
freelance84 Posted April 29, 2010 Author Share Posted April 29, 2010 ooooh yea! Thanks, I completely forgot about that. Quote Link to comment Share on other sites More sharing options...
freelance84 Posted April 30, 2010 Author Share Posted April 30, 2010 Hmm, I've just got round to trying to get the two buttons on the same line... I changed my code to <tr> <td colspan="2" align="center" nowrap="nowrap"> <button id="button-submit_2" type="submit">Add Name</button></form> <form action="nrt-home-edit&delete.php" method="post"><input type="hidden" name="class_name" value="$class_name[0]"/> <button id="button-submit_2" type="submit">Finish</button></form> </td> </tr> But the two buttons are still refusing to share the same line and the result is two buttons centred in the td but one on top of the other. Does anyone have any ideas? Quote Link to comment Share on other sites More sharing options...
freelance84 Posted April 30, 2010 Author Share Posted April 30, 2010 P.S. This is the stlye the button takes from the .css: #button-submit_2 { cursor:pointer; width:100px; color:#666666; text-align: center; font-size: small; padding: 0px; height: 20px; vertical-align: middle; background-color: #CCCCCC; } Quote Link to comment Share on other sites More sharing options...
F1Fan Posted April 30, 2010 Share Posted April 30, 2010 I'm sorry, I just noticed that you have two different forms in your cell. That's the problem. I have seen that, by default, forms have line breaks after them. I've never tried styling them before, but try that. Add "display: inline;" and/or "float: {left or right};" to the styling of the forms. Quote Link to comment Share on other sites More sharing options...
freelance84 Posted April 30, 2010 Author Share Posted April 30, 2010 Ah right ok I'll give it a shot thanks Quote Link to comment Share on other sites More sharing options...
freelance84 Posted April 30, 2010 Author Share Posted April 30, 2010 Brilliant, it worked! Thanks again Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.