Inside an HTML table. I have an input with a display flex parent with a width. The input is overflow hidden. I get a different behavior between browsers. Chrome shrinks the input field to the width. Firefox does not.
If I put width:100% on the input it starts working on firefox but I would like to not add that style.
div {
display: flex;
width: 50px;
}
.myInput {
overflow: hidden;
}
<table>
<tr>
<td>
<div><input class="myInput" value="0.50"></div>
</td>
<td>test</td>
</tr>
</table>
EDIT:
Filed a bug with Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1882139
2
Answers
I’d recommend setting
min-width: 0;
instead ofoverflow: hidden;
.Who knows whether it is a bug or not, as it involves a table, flexbox, and replaced elements like an
<input>
, which has intrinsic dimensions.overflow: hidden
needs to be on the parent element to hide the part of the input that overflows the parent’s width.