March 12, 201016 yr Hi, I'm now looking into creating a login page for my website, but I'm having trouble getting the table cells to look how I want them to. I'm using this code at the mo: <div id="client-login-table"> <table width="250" border="0" align="center" cellpadding="0" cellspacing="1"> <tr> <form name="form1" method="post" action="checklogin.php"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="20"> <tr> </tr> <tr> <td width="300"><input name="myusername" type="text" id="myusername"></td> </tr> <tr> <td><input name="mypassword" type="text" id="mypassword"></td> </tr> <tr> <td><input type="image" src="images/submit.png" name="Submit" value="Login"></td> </tr> </table> </td> </form> </tr> </table> </div> </div> I've tried changing all of the width values and adding some other attributes but nothing works. Thanks for any help
March 12, 201016 yr Hi, I'm now looking into creating a login page for my website, but I'm having trouble getting the table cells to look how I want them to. I'm using this code at the mo: <div id="client-login-table"> <table width="250" border="0" align="center" cellpadding="0" cellspacing="1"> <tr> <form name="form1" method="post" action="checklogin.php"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="20"> <tr> </tr> <tr> <td width="300"><input name="myusername" type="text" id="myusername"></td> </tr> <tr> <td><input name="mypassword" type="text" id="mypassword"></td> </tr> <tr> <td><input type="image" src="images/submit.png" name="Submit" value="Login"></td> </tr> </table> </td> </form> </tr> </table> </div> </div> I've tried changing all of the width values and adding some other attributes but nothing works. Thanks for any help looks to me your missing out the px example 250px, or % like on your code one is set at 100%
March 12, 201016 yr Your main table is 250px wide, then the inner table in the form is 100% wide which is OK, but then you have a td tag which is 300px wide - too wide. I think I would put the form inside the td tag, not between a tr tag and a td tag. <div id="client-login-table"> <table width="500" border="0" align="center" cellpadding="0" cellspacing="1"> <tr> <td> <form name="form1" method="post" action="checklogin.php"> <table width="100%" border="0" cellpadding="3" cellspacing="20"> <tr> </tr> <tr> <td width="300"><input name="myusername" type="text" id="myusername"></td> </tr> <tr> <td><input name="mypassword" type="text" id="mypassword"></td> </tr> <tr> <td><input type="image" src="images/submit.png" name="Submit" value="Login"></td> </tr> </table> </form> </td> </tr> </table> </div> </div>
March 12, 201016 yr Author Oops I didnt realise I left that value as 300, I must of changed that when I was playing with it. Anyway, i've fixed my own problem now..i didnt realise that you had to use the attribute 'size' for the input area, i was trying to use width. I changed this: <td width="300"><input name="myusername" type="text" id="myusername"></td> To this: <td width="300" ><input name="myusername" type="text" id="myusername" size="25"></td> and its OK now. Thanks for the fast replies anyway
March 12, 201016 yr so you meant the area you put text - username/password not the table surrounding it.
March 12, 201016 yr Author Yeah, sorry for being confusing. I've never used tables before so getting used to them still.
March 12, 201016 yr no need to be sorry, we all make mistakes and we all learning no matter what level we are at, we can all make the smallest of mistakes, iv had experts tell me somethings not possible when it is
March 12, 201016 yr I changed this: <td width="300"><input name="myusername" type="text" id="myusername"></td> To this: <td width="300" ><input name="myusername" type="text" id="myusername" size="25"></td> You can use width or size for the input tag and other form tags, in fact it's often more accurate because some browsers like Safari seem to make the "size" a different number of pixels, so you could have:- <td><input style="width: 300px;" name="myusername" type="text" id="myusername"></td> where the width is for the input tag, not the td tag. (or give a class to the input tag with the width in a stylesheet).
March 12, 201016 yr Author You can use width or size for the input tag and other form tags, in fact it's often more accurate because some browsers like Safari seem to make the "size" a different number of pixels, so you could have:- <td><input style="width: 300px;" name="myusername" type="text" id="myusername"></td> where the width is for the input tag, not the td tag. (or give a class to the input tag with the width in a stylesheet). Ahh I understand now, I didn't use the 'style' part as well. I'm gonna stick with what I've got at the moment because this is only a practise website but I'll use your input in the future, thanks!
Create an account or sign in to comment