【发布时间】:2016-11-24 11:13:15
【问题描述】:
是否可以内联(在 DOM 中)应用 CSS 过渡,而不使用伪选择器或使用 JS 在 dom 上添加和更改属性 class?
.
#target{
width: 100px;
height:100px;
background-color:red;
}
<div id="target" style="transition: opacity 1s linear;"></div>
【问题讨论】:
-
是的,我们可以。然而,仅仅因为你可以并不意味着你应该;-)
-
@JohnSlegers 为什么不呢?