javascript - 无法将属性 "max-content"添加到 @key-frames

标签 javascript css angular nativescript

我正在尝试制作可折叠的内容,但 css 不接受动画中的“max-content”属性。我收到错误:内容高度的“无效值:最大内容”。 当我在没有@keyframes 的情况下设置高度时它可以工作,但我希望它是动画的

.full {
    animation-name: fullText;
    animation-duration: 0.2s;
    animation-fill-mode: forwards;
  }

  .short{
    animation-name: shortText;
    animation-duration: 0.2s;
    animation-fill-mode: forwards;
  }

@keyframes fullText {
    from { height: 150; }
    to { height: max-content; }
  }

  @keyframes shortText {
    from { height: max-content; }
    to { height: 150; }
  } 

最佳答案

确保你的浏览器支持最大内容

https://caniuse.com/#search=max-content

关于javascript - 无法将属性 "max-content"添加到 @key-frames,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58056436/

相关文章:

css - 使用 css 而不是 jquery 设置页面滚动顶部

Angular2 无法读取未定义的属性 'push'

javascript - YouTube ajax,.replace() 不起作用

javascript - 如何独立滚动 2 个不同的面板?

javascript - 如何在 react 中悬停时在图像上添加过渡时间?

具有水平扩展选择选项的 HTML 表单

Angular - 在另一个组件中动态注入(inject)一个组件

javascript - 使用 OpenLayers 在 OSM 中显示自定义本地镜像标记

javascript - NVD3 调度事件不适用于 HistoricalBarChart

javascript - 当用户复制和粘贴内容时,如何检查复制的数据与禁止的输入?