这个问题困扰我好久了。每当我调整窗口大小时,CSS 的行为真的很奇怪。我会给你看图片,因为我很难解释。
它应该如何:
它不应该是这样的:
即使我使用百分比高度而不是像素,它也会出错。
我在这里链接了源代码,在调整窗口大小时出现同样的问题:
jsfiddle.net/nxa747ca/
最佳答案
它不起作用,因为你有 position:fixed
和 position: absolute
在你的课上。
首先要确定 html 的顺序:
<div class="chat-messages"></div>
<input type="text" class="chat-name" placeholder="Type your message">
在你的 css 上删除 position: absolute;
在 chat-messages
和 position: fixed;
在 .chat-name
它们应该只是默认值 position: relative;
关于html - CSS:调整大小时高度不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43160274/