css - 高度/宽度 : 100% and --webkit-fill-available 之间有什么区别

标签 css

我已经使用 100% 和 --webkit-fill-available 很长时间了。 有时 --webkit-fill-available 会给出除 height: 100% 以外的其他结果。

有人知道它们之间有什么区别吗?

 {
   height: --webkit-fill-available
 }

 {
   height: 100%
 }

最佳答案

首先,避免使用前缀属性,因为它们仅受特定浏览器支持。

-webkit-fill-available 是 WebKit 浏览器用于 stretch 的非标准名称,a experimental feature that should not be used in production .

我猜 fit-content 会具有相同的行为,并具有受所有现代浏览器支持的优势。 According to MDN :

The fit-content behaves as fit-content(stretch). In practice this means that the box will use the available space, but never more than max-content [the intrinsic maximum width or height of the content].

最后,height: 100% 等于元素包含 block 的高度。

关于css - 高度/宽度 : 100% and --webkit-fill-available 之间有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69286528/

相关文章:

html - 图像在 IE 9 中不显示

html - 多个图像下方的文本对齐

html - 如何防止复制文本的 css 样式也被复制

javascript - 如何将单选按钮的选择限制为一次

html - 标题出现在悬停输入文本时

css - 我如何检测 CSS 过滤器的特征?

css - 自定义图标选项卡 Ionic 3

html - 在不扭曲图像的情况下动画div高度

css - Bootstrap 行扩展到包含列之外

javascript - 灯箱图片比灯箱本身大