bart2puck bart2puck - 24 days ago 6
CSS Question

border spacing when input text 100%

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>




Answer

You need to remove the padding from the cells (table data ) https://jsfiddle.net/djyk8927/5/

td {
    padding: 0px;
}