html – css height:auto not working

html – css height:auto not working,第1张

概述参见英文答案 > Why doesn’t the height of a container element increase if it contains floated elements?                                    7个 inner1和inner2 div在外部div中,外部高度仍然为0px,height为auto 如何获得外部div的子元素的高度? 参见英文答案 > Why doesn’t the height of a container element increase if it contains floated elements?7个
inner1和inner2 div在外部div中,外部高度仍然为0px,height为auto

如何获得外部div的子元素的高度?

<style>#outer {    wIDth:300px;    height:auto;;    background:#ccc;    }#inner1 {    @R_502_5987@:left;    wIDth:100px;    height:100px;    background:#f00;}#inner2 {    @R_502_5987@:left;    wIDth:100px;    height:100px;    background:#0f0; }</style><div ID="outer">    <div ID="inner1"></div>    <div ID="inner2"></div></div>
解决方法 添加溢出:自动到ID为外部的div.这将解决您的问题.

Demo

总结

以上是内存溢出为你收集整理的html – css height:auto not working全部内容,希望文章能够帮你解决html – css height:auto not working所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1141537.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-31
下一篇 2022-05-31

发表评论

登录后才能评论

评论列表(0条)

保存