我可以为 CSS 网格布局组件设置动画吗?

Can I animate CSS Grid Layout components?

有没有办法为数组中组件的顺序更改设置动画,这些组件以 CSS 网格布局显示?

这里是短片boilerplate

没有。

According to the CSS Grid Layout Module Level 1 specification there are 5 animatable grid properties:

grid-gap, grid-row-gap, grid-column-gap as length, percentage, or calc

grid-template-columns, grid-template-rows as a simple list of length, percentage, or calc, provided the only differences are the values of the length, percentage, or calc components in the list.

Source

如果你只想让用户看到文字的变化,你可以让一个javascript,替换每个div的文字。在这种情况下,divs 将是相同的(例如 div-1、div-2、div-3)。您只会更改文本。

如果要更改完整 div + 内容(在 html 中)的位置及其 css 属性,则必须扩展 javascript拥有一个接受 3 个值并随机排列它们的函数(比如 1,3,2)。通过 javascript,您可以根据需要删除和创建 div。

是的,Firefox v66 支​​持