[英]<div> with min-width value grows but then doesn't return to its min-width size
尽管我在stackoverflow和google上进行了搜索,但找不到解决方案:我有一个<div>
,它在另一个div中包含另一个div,因此:
<div class="father" style="min-width: 800px;">
<div class="child">
<div class="grandchild">
...content, which can make this div grow beyond its father's and grandfather's size...
</div>
</div>
</div>
在这里,如果内容使容器的大小增长到800像素以上,然后将内容更改为小于800px的宽度,则外部div仍会保持超大尺寸,并且不会返回其原始大小。 即使按F5或CTRL + F5也无济于事。
有没有办法解决此问题而无需使用JavaScript?
提前致谢!
ps:即使我使用了4个空格,代码似乎也没有缩进,对此感到抱歉。
摆脱宽度并设置overflow:hidden
到父亲div
.father{overflow:hidden;}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.