gpt4 book ai didi

html - flex-basis : auto and flex-basis: content? 之间有什么区别

转载 作者:行者123 更新时间:2023-12-03 17:35:19 26 4
gpt4 key购买 nike

我一直在阅读MDN articleflex-basis css 属性。在那里我没有看到 flex-basis: auto 的任何定义.它解释了flex-basis: content .好像content现已更换auto .但如果是这样,那为什么是 auto还是初始值?

最佳答案

MDN article自从最初提出这个问题以来,似乎已经更新。简而言之:

  • auto意思是“看看我的宽度或高度属性”。
  • content意思是“看看我的内容”。

  • 当元素具有固定的 width 时,这确实会导致细微的差异。或 height .如果您查看此 live demo,您会注意到这种差异仅在 Firefox 中(在撰写本文时,值 contentONLY supported in Firefox)。
    还要引用同一 MDN 文章中的历史注释:
    • Originally, flex-basis:auto meant "look at my width or height property".
    • Then, flex-basis:auto was changed to mean automatic sizing, and "main-size" was introduced as the "look at my width or height property" keyword. It was implemented in bug 1032922.
    • Then, that change was reverted in bug 1093316, so auto once again means "look at my width or height property"; and a new content keyword is being introduced to trigger automatic sizing. (bug 1105111 covers adding that keyword).

    关于html - flex-basis : auto and flex-basis: content? 之间有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45038372/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com