I have a table that has fixed width, and inside the table I need to have some inputs(text)
that has the same width of the table, but I don't want the text of the inputs to be at left:0
, I want them to have some padding from the left. But when I put the padding to those inputs the width changes to more than 100%
.
Here the HTML:
<table cellspacing="25">
<tr>
<td><input type="text" placeholder="lalala"></td>
</tr>
</table>
And this is the CSS.
table {
background-color: red;
width: 300px;
}
table input {
width: 100%;
padding-left: 10px;
}
How can I ensure that the width of the input element is 100%
the width of the table cell?