html - CSS:调整大小时高度不正确

标签 html css

这个问题困扰我好久了。每当我调整窗口大小时,CSS 的行为真的很奇怪。我会给你看图片,因为我很难解释。

它应该如何:

How it should be

它不应该是这样的:

How it shouldn't be

即使我使用百分比高度而不是像素,它也会出错。

我在这里链接了源代码,在调整窗口大小时出现同样的问题:

jsfiddle.net/nxa747ca/

最佳答案

它不起作用,因为你有 position:fixedposition: absolute在你的课上。

首先要确定 html 的顺序:

<div class="chat-messages"></div> <input type="text" class="chat-name" placeholder="Type your message">

在你的 css 上删除 position: absolute;chat-messagesposition: fixed;.chat-name它们应该只是默认值 position: relative;

关于html - CSS:调整大小时高度不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43160274/

相关文章:

java - 向组件 Vaadin 添加属性

css - 在图像上放置文本的问题(CSS,相对定位)

html - Kendo 表中的 Bootstrap 下拉列表?

javascript - 使用 JavaScript 打印时媒体打印不正确

html - 如何使用垂直偏移将 Bootstrap 列拉到顶部?

html - Angular *ngFor 生成表 4 个单元格宽

html - <col> 标签不能进行文本对齐吗? <col> 表示 <colgroup> 中列的组

html - 单击按钮时使用自定义管道的 Angular 过滤表

html - 从页面外加载正文内容 -> 在页面加载时从左到右

javascript - scrollIntoView() 不工作 : does not taking in account fixed element