在内容之前不使用手写笔标题循环

时间:2017-04-06 15:30:42

标签: css stylus

工作代码:

手写笔

io.undertow

HTML

for num, $s in (1..6)
    h{$s+1}
        display inline-block

不工作代码:

手写笔

h1:before {
  position: relative;
}
h2:before {
  position: relative;
}
h3:before {
  position: relative;
}
h4:before {
  position: relative;
}
h5:before {
  position: relative;
}
h6:before {
  position: relative;
}

如何使得结果代码成为下一个,并且可以显示在css之前的内容中

HTML

for num, $s in (1..6)
    h{$s+1}
        &:before
            display inline-block
            content h{$s+1}

任何可能的解决方案?

1 个答案:

答案 0 :(得分:0)

Work code:

Stylus

for $i in (1..6)
    h{$i}
        &:before
            content "h" + $i

HTML

h1:before {
  content: 'h1';
}
h2:before {
  content: 'h2';
}
h3:before {
  content: 'h3';
}
h4:before {
  content: 'h4';
}
h5:before {
  content: 'h5';
}
h6:before {
  content: 'h6';
}