我的ul
内有N li
。我希望将每个li
旋转360/N
度,以便它们形成一个轮子。
我在Stylus中尝试了很多语法来实现这一点,但我总是得到同样的错误:
期待" ident"或"字符串",得到"单位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"
有谁知道正确的语法?
答案 0 :(得分:2)
更容易:
n=8
for i in (1..n)
li:nth-child({i})
transform rotate(360/i deg)