my dog learned polymorphism
The moose likes HTML, CSS and JavaScript and the fly likes How to reduce cell heigt in a Table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to reduce cell heigt in a Table" Watch "How to reduce cell heigt in a Table" New topic

How to reduce cell heigt in a Table

Kishan Kumar
Ranch Hand

Joined: Sep 26, 2000
Posts: 130
Iam attaching a html code below which displays three rows i.e.
First Name, Last Name and Email Address and each having a corresponding textbox for user to enter. On putting the table border as 1 I see that all the space inside the first row is occupied. But the second and third row there is space around the cells. I do not want this extra space inside the cell. I could not determine what is contributing to the height of the cell and why is that only the first row has no space around it while the second and third row has.
<link rel="stylesheet" href="bcs_styles.css" type="text/css">
<FORM name="f1" method="post" value="">
<TABLE border="1" cellspacing="0" cellpadding="0">
<TR> <!-- First Name -->
<TD width="39%" align="right" class="boldlabels">First Name :</TD>
<TD width="1%"> </TD>
<TD width="60%" align="right">
<INPUT type="text" value="Kishan Kumar" name="first_name_in"
size="35" class="normal" maxlength="40"></TD>

<TR> <!-- Last Name -->
<TD width="39%" height="39" align="right" class="boldlabels">Last Name :</TD>
<TD width="1%" > </TD>
<TD width="60%" height="39" align="right">
<INPUT type="password" value="Vemuru" NAME="last_name_in"
size="35" class="normal" maxlength="40"></TD>

<TR> <!-- Email Address -->
<TD width="39%" height="39" align="right" class="boldlabels">
E-mail address :</TD>
<TD width="1%" > </TD>
<TD width="60%" height="39" align="right">
<INPUT type="text" value="" NAME="email_address_in"
size="35" class="normal" maxlength="40"></TD>
I would like to see all the three rows just below each other without any space between them. Cellpaddig and cellspacing is not helping either.
Thanks in advance
Kishan Kumar
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
you are assigning the cell a height which is not allowing them to be any closer....
I agree. Here's the link:
subject: How to reduce cell heigt in a Table
It's not a secret anymore!