Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[兼容性] 30. 高度不适应 #815

Open
qiilee opened this issue Nov 28, 2019 · 0 comments
Open

[兼容性] 30. 高度不适应 #815

qiilee opened this issue Nov 28, 2019 · 0 comments

Comments

@qiilee
Copy link
Member

qiilee commented Nov 28, 2019

问题说明:高度不适应是当内层对象的高度发生变化时外层高度不能自动进行调节,特别是当内层对象使用 margin 或 padding 时。

例:

#box {}
#box p {
  margin-top: 20px;
  margin-bottom: 20px;
  text-align: center;
}
<div id="box">
  <p>p对象中的内容</p>
</div>

解决办法:在 p 对象上下各加 2 个空的 div 对象 CSS 代码{height:0px;overflow:hidden;}或者为 div 加上 border 属性。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant