我有一个里面有N li
ul
。我想将每个li
旋转 360/N
度,以便它们形成一个轮子。
代码笔
我已经在 Stylus 中尝试了许多语法来实现这一点,但我总是收到相同的错误:
预期的"标识"或"字符串",得到"单元 360">
例如:
n=8
for i in (1..n)
li:nth-child({i})
transform rotate( {360/i}deg ) // expected "ident" or "string", got "unit 360"
或
n=8
for i in (1..n)
li:nth-child({i})
transform rotate( {360/i + 'deg'} ) // expected "ident" or "string", got "unit 360"
或
n=8
rotation = 0deg
for i in (1..n)
li:nth-child({i})
transform rotate( rotation )
rotation = rotation + {360/i} + "deg" // expected "ident" or "string", got "unit 360"
或
n=8
rotation = 0deg
for i in (1..n)
li:nth-child({i})
transform rotate( rotation )
rotation += {360/i + "deg"} // expected "ident" or "string", got "unit 360"
有谁知道正确的语法?
它更容易:
n=8
for i in (1..n)
li:nth-child({i})
transform rotate(360/i deg)