我有以下代码:
for i in (1..5)
div:nth-child({i})::after
content \'i*i\'
for i in (6..10)
div:nth-child({i})::after
ij = (i - 5)
content \'(ij*ij)\'
for i in (1..10)
div:nth-child({i})
ij = (i - 5)
if i >= 6
height ij * ij px
else
height i * i px
输出以下内容:
但是我需要在25时反转,所以它会:
1 4 9 16 25 25 16 16 9 4 1
不知道该怎么做?
最佳答案
将计算ij的方式从ij =(i-5)更改为ij = 11-i
for i in (1..5)
div:nth-child({i})::after
content \'i*i\'
for i in (6..10)
div:nth-child({i})::after
ij = 11-i
content \'(ij*ij)\'
for i in (1..10)
div:nth-child({i})
ij = 11-i
if i >= 6
height ij * ij px
else
height i * i px
关于css - 如何在中途反转循环?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24996135/