I have a table in bootstrap 3
<table class="table table-bordered table-condensed">
<tbody>
<tr>
<td><input type="text" class="form-control" /></td>
<td><input type="text" class="form-control" /></td>
<td><input type="text" class="form-control" /></td>
<td><input type="text" class="form-control" /></td>
<td><input type="text" class="form-control" /></td>
<td><input type="text" class="form-control" /></td>
</tr>
</tbody>
</table>
Can I make the input fields look like normal cells? I want the input fields to fill out the entire cells (without no input margin nor table cell padding). Just like an Excel spreadsheet where I have many cells and can write in each of them.
Yup. Do it this way:
input {display: block; padding: 0; margin: 0; border: 0; width: 100%;}
td {margin: 0; padding: 0;}
You could also try using contentEditable tables like this: DEMO
<table>
<tbody>
<tr>
<th></th>
<th>A</th>
<th>B</th>
<th>C</th>
</tr>
<tr>
<th>1</th>
<td><span id="A1" contenteditable>#####</span></td>
<td><span id="B1" contenteditable></span></td>
<td><span id="C1" contenteditable></span></td>
</tr>
<tr>
<th>2</th>
<td><span id="A2" contenteditable></span></td>
<td><span id="B2" contenteditable></span></td>
<td><span id="C2" contenteditable></span></td>
</tr>
</tbody>
</table>
span {
width: 100%;
display: block;
}
*note, the content editable spans are required for IE to handle the contentEditable attributes correctly. Reference
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With