1

I have a table cell containing an input:

<body>
  <table>
    <tr>
      <td><input type="submit" class="submitbutton" value=""/></td>
    </tr>
  </table>  
</body>

That input is styled to have a height of 20 pixels:

table
{
  border-spacing: 0;
  border-collapse: collapse;
}

td
{
  padding: 0;
}

.submitbutton
{
  width: 19px;
  height: 20px;
  border: 0px;
  outline: none;
  margin:0;
}

http://jsfiddle.net/VhhPf/2/

When I use firefox and look in the layout tab, I can see that the input is having height 20, but the td is for some reason having the height 21. In chrome, the td will get the height 24.

Why?

enter image description here

enter image description here

enter image description here

enter image description here

tewathia
  • 6,890
  • 3
  • 22
  • 27
Anders Lindén
  • 6,839
  • 11
  • 56
  • 109

1 Answers1

2

It is an inline element, therefore it is being aligned to the baseline of your text.

Add vertical-align:bottom.

See also this question.

Community
  • 1
  • 1
Niet the Dark Absol
  • 320,036
  • 81
  • 464
  • 592