I am working in an environment (kindlegen) that doesn't support max-width
. I have a div
that should be of a specified width unless the viewport shrink, in which case it should shrink with it. max-width
is what I need, but it is not supported.
Is there a HTML/CSS-only workaround? Any clever idea that can achieve the same effect?
(Javascript is not supported either.)
.outside {
width: 14em; /* will change with window (100vw) */
background: orange;
}
.inside {
width: 24em; /* max-width will do it */
background: red;
}
<div class="outside">
<p>Main container</p>
<div class="inside">Inside text that should never be wider than its parent.</div>
</div>