我正在一个不支持max-width的环境(kindlegen)中工作。我有一个div,它应该具有指定的宽度,除非视图端口收缩,在这种情况下,它应该与它一起缩小。max-width是我所需要的,但它不受支持。
有HTML/CSS的解决方案吗?有什么聪明的主意能达到同样的效果吗?
(Javascript也不受支持。)
.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>
发布于 2020-12-10 00:15:37
你能不能做点这样的事,还是我错过了什么?
.outside {
width: 100%;
background: orange;
}
.inside {
width: 80%;
background: red;
}<div class="outside">
<p>Main container</p>
</div>
<div class="inside">
<p>Inside text that should never be wider than its parent.</p>
</div>
https://stackoverflow.com/questions/50186161
复制相似问题