height: fit-content; 在 Firefox 中不起作用。

huangapple go评论119阅读模式
英文:

height: fit-content; not working by firefox

问题

开发工具告诉我,Firefox 不支持 fit-content。有人可以告诉我应该写什么来替代 fit-content 吗?

  1. .main--5 {
  2. position: relative;
  3. max-width: 100%;
  4. background-color: var(--firstColor);
  5. height: auto; /* 用 auto 替代 fit-content */
  6. opacity: 100 !important;
  7. visibility: visible !important;
  8. pointer-events: auto !important;
  9. display: block;
  10. display: none;
  11. padding: 1.6rem;
  12. overflow-y: hidden;
  13. }
英文:

The dev tool tell me that the fit-content not working by Firefox. Can someone say what should I write instead fit-content.

  1. .main--5 {
  2. position: relative;
  3. max-width: 100%;
  4. background-color: var(--firstColor);
  5. height: fit-content;
  6. opacity: 100 !important;
  7. visibility: visible !important;
  8. pointer-events: auto !important;
  9. display: block;
  10. display: none;
  11. padding: 1.6rem;
  12. overflow-y: hidden;
  13. }

答案1

得分: 2

请查看 caniuse 网站以获取有关 CSS 兼容性的问题。<br/>
如在此页面所解释,您可以使用 -moz-fit-content。<br/>
您还可以在父元素上使用 display:flex,并在子元素上使用 flex-grow:1

英文:

Please take a look at caniuse website for CSS compatibility questions.<br/>
As explain on this page, you can use -moz-fit-content.<br/>
You can also use
display:flex
on parent and flex-grow:1 on child.

huangapple
  • 本文由 发表于 2023年2月24日 00:17:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/75547481.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定