There is no special CSS that can achieve this - as a rule, it is better to avoid references to style / layout rules in the DOM. A CSS flexbox model may be useful for this purpose, to allow the size of elements depending on how many of them exist.
CSS, , Sass, ( SCSS) - , .css . , - 20 , ( , 20, , ).
@for $i from 1 to 20 {
li[depth="#{$i}"] { padding-left: #{($i - 1) * 40px}; }
}