My objective is to print a text file line by line and append the line number at the beginning. Like so:
<div id="wrapper">
<div class="line">1: asdf</div>
<div class="line">2: asdfasdf</div>
<div class="line">3: asdfasdfasdfasdf</div>
<div class="line">4: asdf</div>
</div>
n
is a variable in CSS responsible for an element's index within its parent and within a child selector you can perform operations on it, eg. nth-child(2n + 3
)
Is there any way to grab this variable and insert it as plain text? Essentially like this:
.line:before {
content: n;
}
I know I can accomplish this with SASS which is what I'm using, I was just wondering if there's some way to pull it off with vanilla CSS.