1

I have a form that has input text in cells that are 100% of the cell. I have also collapsed borders and set spacing to 0px. I still see a gap between cells, well actually inputs. How can I remove these gaps between inputs? I'm trying to loosely mimic a spreadsheet.

The Code (https://jsfiddle.net/djyk8927/ ):

#requestorTable{
  border-collapse:collapse;
  border-spacing:0px;
}
input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  -webkit-box-sizing:border-box;
  -moz-box-sizing: border-box;
  border:1px solid #919295;
}
<table id='requestorTable'>
  <tr>
    <td>
      <input type='text' id='item1' name='item1'>
    </td>
    <td>
      <input type='text' id='qty1' name='qty1'>
    </td>
    <td>
      <input type='text' id='price1' name='price1'>
    </td>
  </tr>
  <tr>
    <td>
      <input type='text' id='item2' name='item2'>
    </td>
    <td>
      <input type='text' id='qty2' name='qty2'>
    </td>
    <td>
      <input type='text' id='price2' name='price2'>
    </td>
  </tr>
  <tr>
    <td>
      <input type='text' id='item3' name='item3'>
    </td>
    <td>
      <input type='text' id='qty3' name='qty3'>
    </td>
    <td>
      <input type='text' id='price3' name='price3'>
    </td>
  </tr>
</table>
Sebastian Brosch
  • 42,106
  • 15
  • 72
  • 87
bart2puck
  • 2,432
  • 3
  • 27
  • 53

1 Answers1

1

You need to remove the padding from the cells (table data )

td {
    padding: 0px;
}

input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  border: 1px solid #919295;
}

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

td {
  padding: 0px;
}
<table>
  <tr>
    <td>
      <input type='text' id='item1' name='item1'>
    </td>
    <td>
      <input type='text' id='qty1' name='qty1'>
    </td>
    <td>
      <input type='text' id='price1' name='price1'>
    </td>
  </tr>
  <tr>
    <td>
      <input type='text' id='item2' name='item2'>
    </td>
    <td>
      <input type='text' id='qty2' name='qty2'>
    </td>
    <td>
      <input type='text' id='price2' name='price2'>
    </td>
  </tr>
  <tr>
    <td>
      <input type='text' id='item3' name='item3'>
    </td>
    <td>
      <input type='text' id='qty3' name='qty3'>
    </td>
    <td>
      <input type='text' id='price3' name='price3'>
    </td>
  </tr>
</table>
Kieran Devlin
  • 1,373
  • 1
  • 12
  • 28