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? Link to comment https://forums.phpfreaks.com/topic/200199-buttons-into-one-table-cell/ 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"> Link to comment https://forums.phpfreaks.com/topic/200199-buttons-into-one-table-cell/#findComment-1050658 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. Link to comment https://forums.phpfreaks.com/topic/200199-buttons-into-one-table-cell/#findComment-1050754 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? Link to comment https://forums.phpfreaks.com/topic/200199-buttons-into-one-table-cell/#findComment-1051027 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; } Link to comment https://forums.phpfreaks.com/topic/200199-buttons-into-one-table-cell/#findComment-1051038 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. Link to comment https://forums.phpfreaks.com/topic/200199-buttons-into-one-table-cell/#findComment-1051084 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 Link to comment https://forums.phpfreaks.com/topic/200199-buttons-into-one-table-cell/#findComment-1051107 Share on other sites More sharing options...
freelance84 Posted April 30, 2010 Author Share Posted April 30, 2010 Brilliant, it worked! Thanks again Link to comment https://forums.phpfreaks.com/topic/200199-buttons-into-one-table-cell/#findComment-1051110 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.