- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
Tailwind 提供了多个实用程序来控制哪些 CSS 属性转换,在这些属性中有 transition
和 transition-all
。
我去检查了两个类的 CSS 属性,这里它们的顺序相同。
transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
transition-property: all;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
这两个类之间有什么区别?我应该使用哪一个进行一般转换?
最佳答案
要了解差异,您需要了解有关可动画属性的重要事项。其中一些会触发布局更改,而另一些则不会。
触发布局更改的属性会对性能产生影响,因此建议尽可能避免使用它们
不触发布局更改的属性对性能的影响较小,建议为它们设置动画。
tailwind 的 transition
类对第二组属性(不触发布局更改的属性)进行分组,而 transition-all
对所有属性进行分组。
最好依靠 transition
来获得良好的性能,并且您应该尽可能避免使用 transition-all
但是如果您必须为 all< 设置动画/em> 然后使用它的属性。
这里有一个很好的引用,可以帮助您理解我在说什么:https://csstriggers.com/
如果您检查 color
你可以阅读:
Changing color does not trigger any geometry changes, which is good.
作为旁注,transform
在性能方面是最好的。它不会触发布局更改,也不会触发绘画:
Changing transform does not trigger any geometry changes or painting, which is very good. This means that the operation can likely be carried out by the compositor thread with the help of the GPU.
关于html - TailwindCSS 中的 transition-all 和 transition 有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67363406/
尝试添加动画以替换 fragment 时抛出该异常。根据这个答案,stackoverflow ,过渡框架不能应用于 fragment ,但这篇文章表明你可以 How to use Material T
还有其他一些类似的问题,但都涉及 Android 支持库。我正在使用新的 androidx 库。 将 androidx 生命周期依赖项从 2.2.0-alpha03 更新到 2.2.0-alpha04
这个问题在这里已经有了答案: What is an optional value in Swift? (15 个答案) When two optionals are assigned to an i
Tailwind 提供了多个实用程序来控制哪些 CSS 属性转换,在这些属性中有 transition 和 transition-all。 我去检查了两个类的 CSS 属性,这里它们的顺序相同。 tr
Tailwind 提供了多个实用程序来控制哪些 CSS 属性转换,在这些属性中有 transition 和 transition-all。 我去检查了两个类的 CSS 属性,这里它们的顺序相同。 tr
这是一个由两部分组成的问题: 哪种应用样式优先:CSS 中的 -webkit-transition 规则或 jQuery 中类似的 $.css() 方法? 如果我还在 jQuery 中使用 .css
我想知道为什么在 FireFox 中使用 transition: all 0.5s ease-out; 时我会看到元素上的闪烁效果(截至本文撰写时的最新版本)。很难解释,但请在此处查看实际示例:htt
我对 css3 过渡属性的渲染速度有疑问。 假设我有一些元素: div, span, a {transition: all} div {margin: 2px} span {opacity: .5}
我对 css3 过渡属性的渲染速度有疑问。 假设我有一些元素: div, span, a {transition: all} div {margin: 2px} span {opacity: .5}
我目前正在用 Html 制作我的第一个网站,javascript 作为前端将首先出现。 我正在尝试创建一个折叠侧边栏,当我单击顶部导航右侧的按钮时会出现该侧边栏,但我对过渡效果有疑问,因为它会将所有内
我有一个 Activity ,一次托管一个 fragment ,并在两个 fragment 之间交换。 fragment A 使用按钮启动 fragment B, fragment B 使用按钮或后退
我正在尝试创建一种效果: 光标悬停在一个框上 横杆滑出 随着滑动 Action 缓和,标题出现 光标离开方框 随着栏向后滑动,标题开始消失 横杆完成向后滑动 但是,当光标离开框时,会再次调用延迟,因此
让我提供一些背景信息:我正在构建一个选项卡式应用程序,允许用户查找和查看我们服务器上托管的一些视频。每个选项卡都以不同的方式对视频进行分组,导航栏中有一个分段控件,用户可以使用该控件更精确地对列表进行
原始问题...更新了以下工作代码: 我有一个在 ajax 加载事件期间出现的加载图像。图像通过向 body 元素添加或删除“加载”类来显示/隐藏。目前,加载图像将背景大小设置为从 0% 到 100%
我对 css3 过渡属性的渲染速度有疑问。 假设我有一些元素: div, span, a {transition: all} div {margin: 2px} span {opacity: .5}
当我继续学习前端开发和练习 Sass 优化我的 CSS 代码时,我又遇到了另一种情况。 在互联网上进行研究和教程后,我在 Sass 中设置了名为“transition”的全局混合。代码如下所示: @m
关于 Chrome 和 css 转换的问题太多了,我不确定以前是否有人问过这个问题。 我的情况是这样的:我的布局基本上是左右分页。右侧的一框内容需要显示在左侧的内容之上(这个我没有发言权,桌面和移动之
我在两个 Activity 之间的共享元素中使用了自定义 Transition。 我的转换不起作用,因为 TransitionValues 参数在 captureStartValues 和 这两种方法
我在 google Chrome 和 Safari 上运行我的应用程序,两者都兼容 webkit。我正在使用 -webkit-transition 构建一个滚动的 div。 当我将文档类型指定为 HT
以下代码在 chrome 中产生了预期的结果,即;直接向所有元素添加过渡延迟。 $('.front-nav .sub-menu').each(function() { var transiti
我是一名优秀的程序员,十分优秀!