I've been trying a few things but didn't find any that perfectly fits what I want to do.
The following snippet is the kind of things I'd like to achieve…
ul {
--liWidth: 10px;
}
ul li {
margin-left: calc(var(--liWidth) * var(--n));
font-size: calc(20px - 1px * var(--n));
}
<ul>
<li style="--n: 1;">LI 1</li>
<li style="--n: 2;">LI 2</li>
<li style="--n: 3;">LI 3</li>
<li style="--n: 4;">LI 4</li>
<li style="--n: 5;">LI 5</li>
<li style="--n: 6;">LI 6</li>
<li style="--n: 7;">LI 7</li>
<li style="--n: 8;">LI 8</li>
</ul>
… But without using my n
CSS-var.
Why? I don't want to type it if using a hundred li
s.
Is there anything like margin-left: calc(var(--liWidth) * nth-of-type());
possible ?
If it's not, what is the easiest without using JavaScript ? (I already know how to do with it)
Thanks in advance.