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

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

height: fit-content; not working by firefox

问题

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

.main--5 {
  position: relative;
  max-width: 100%;
  background-color: var(--firstColor);
  height: auto; /* 用 auto 替代 fit-content */
  opacity: 100 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  display: block;
  display: none;
  padding: 1.6rem;
  overflow-y: hidden;
}
英文:

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

.main--5 {
  position: relative;
  max-width: 100%;
  background-color: var(--firstColor);
  height: fit-content;
  opacity: 100 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  display: block;
  display: none;
  padding: 1.6rem;
  overflow-y: hidden;
}

答案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:

确定