Reputation: 871
I have a parent element with some child elements. The child elements have a min-width
set, but the parent does not. When the browser window is smaller than the min-width
, the child elements are the correct width, but the parent keeps getting smaller, causing the children to overflow. Is it possible to force the parent to be at least as wide as the children? (without using javascript)
(drag divider most of the way to the right and then scroll right in the result window)
Upvotes: 1
Views: 1381
Reputation: 660
Set the min-width on the parent and on the child inherit ... but the parent of the td
in your script is not the div
but the tr
... the parent of the tr
is the table
... and the parent of the table
is the div
.
Upvotes: 2
Reputation: 3416
Your issue in this situation is that you're using a relative width for the parent and a fixed min width for the children. The solution you're trying to handle is not possible in straight CSS. You should instead use relative widths for all elements or establish a fixed min width for the parent.
Upvotes: 1