<td> width problem?

liunx

Guest
Hi,<br />
I know this is very kiddy question. But kindly answer this. <br />
<br />
Actually, in the below code, I want to make 3 fields i.e. of First Name, Middle Name and Last Name in one row having equal gap. I have shown this gap with blue, green and red colors. I dont know how to minize the blue area. I cannot underatand the width attribute of <td>. Or is there any way to control via CSS?<br />
Kindly explain.<br />
<br />
Bye,<br />
Viki.<br />
<br />
<br />
<html><br />
<head><br />
<style type="text/css"><br />
<br />
--><br />
<br />
#fatherTable{<br />
background-color: #e4d2b8;<br />
position: absolute;<br />
left: 10px;<br />
top: 284px;<br />
width: 980px;<br />
}<br />
--><br />
</style><br />
<br />
</head><br />
<br />
<body><br />
<form><br />
<br />
<br />
<div id="fatherTable"> <br />
<table border="0" cellpadding="0"><br />
<td width=122 > <br />
<th width="351"> <b><font face="Arial" size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Father's Information</font></b><br />
</th><br />
</td><br />
<br />
<tr><br />
<br />
</tr><br />
<br />
<tr><br />
<br />
<td width="100" bgcolor="FFCC00" ><font face="Arial" size="3">Fisrt Name</font><br />
</td><br />
<td width="100" bgcolor="blue" ><font face="Arial" size="2"><input type="text" name="Student_Family_Name" size="20"><br />
</font><br />
</td><br />
<br />
<td width="118" bgcolor="FFCC00" ><font face="Arial" size="3"><br />
Middle Name </font><br />
</td><br />
<td width="149" bgcolor="green"><font face="Arial" size="2"><input type="text" name="Grandfathers_Name" size="20"></font><br />
</td><br />
<br />
<td width="118" bgcolor="FFCC00" ><font face="Arial" size="3"><br />
Last Name </font><br />
</td><br />
<td width="149" bgcolor="red"><font face="Arial" size="2"><input type="text" name="Grandfathers_Name" size="20"></font><br />
</td><br />
<br />
<br />
<br />
</tr><br />
<br />
</table><br />
<br />
<br />
<br />
</form> <br />
</html><!--content-->Give me a little while and Ill have your code rewritten.<!--content--><html><br />
<head><br />
<style type="text/css"><br />
#fatherTable{<br />
background-color: #e4d2b8;<br />
position: absolute;<br />
left: 10px;<br />
top: 284px;<br />
}<br />
#datatbl {<br />
border:0px;<br />
padding:0px;<br />
}<br />
.capcell {<br />
background-color:ffcc00;<br />
font:arial;<br />
}<br />
</style><br />
</head><br />
<body><br />
<form><br />
<div id="fatherTable"> <br />
<table id="datatbl"> <br />
<th style="font:Arial; text-align:center;" colspan="6"><br />
<h2>Father's Information</h2><br />
</th><br />
<tr><br />
<td class="capcell" style="width:100px;"><br />
<h4>First Name</h4><br />
</td><br />
<td style="background-color:blue;" ><br />
<input type="text" name="Student_Family_Name" size="20"><br />
</td><br />
<td class="capcell" style="width:118px;"><br />
<h4>Middle Name</h4><br />
</td><br />
<td style="background-color:green;"><br />
<input type="text" name="Grandfathers_Name" size="20"><br />
</td><br />
<td class="capcell" style="width:118px;"><br />
<h4>Last Name</h4><br />
</td><br />
<td style="background-color:red;"><br />
<input type="text" name="Grandfathers_Name" size="20"><br />
</td><br />
</tr><br />
</table><br />
</form> <br />
</html><br />
<br />
<br />
It would be better if you put the text box and caption in the same cell. As a matter of fact, this whole table is pointless and not neccessary. You can just put this all into 2 divs and have it work just fine. Why have the cells around the text boxes? You can style an input just like any other element. I dropped all the font tags in this, and I dropped the widths on the cells with the input. It is the tables nature to stretch, so put the width on the text box. Also, the reason you had that blue space is because you were not applying colspan to the <th>, if you want it to span accross 6 cells, you have to say colspan="6".<br />
<br />
<!-- m --><a class="postlink" href="http://quasi-ke.servebeer.com/fathertable.html">http://quasi-ke.servebeer.com/fathertable.html</a><!-- m --> is this stuff above in action.<!--content-->Hi,<br />
Thanks man. Specially for the brief explanation. I am trying my best to use CSS where ever possible; specially for the elements which are common through out the table and forms.<br />
<br />
<br />
Bye,<br />
Viki.<!--content-->
 
Back
Top