I have a simple structure that represents the parents of current navigation (like breadcrumbs).
ul {
list-style: none;
padding: 0;
margin: 0;
}
ul > li {
padding: 0;
margin: 0;
display: flex;
}
ul > li ~ li:before {
content: '⤷';
display: inline-block;
padding: 0 5px;
}
/* I want to make this part dynamic to cover an infinite amount of child nodes: */
ul > li ~ li ~ li {
padding-left: 20px;
}
ul > li ~ li ~ li ~ li {
padding-left: 40px;
}
ul > li ~ li ~ li ~ li ~ li {
padding-left: 60px;
}
<ul>
<li>Parent #1</li>
<li>One more parent</li>
<li>Another parent</li>
<li>A very long item with potential page break,<br /> br tag just used as an example</li>
<li>Current item</li>
</ul>
How can I make the left padding of each li sibling 20px extra compared to the sibling before? I cannot change the html and I cannot use javascript.
Edit: The item text can have one or more lines (automatic word break, if the subject is to long). I've modified the example to cover the case where a line break occurs.