KnpMenu icon indicating copy to clipboard operation
KnpMenu copied to clipboard

Label with hierarchical numbering 1.2.2.1

Open flaushi opened this issue 5 years ago • 0 comments

I am using the ListRenderer to create a table of contents for a webpage (actually I use https://github.com/caseyamcl/toc and th OrderedListRenderer).

Using some CSS pseudo elements, I am able to get hierarical numbering dynamically:

<style>
		ol {
			list-style-type: none;
			counter-reset: item;
			margin: 0;
			padding: 0;
		}
		ol > li {
			display: table;
			counter-increment: item;
			margin-bottom: 0.6em;
		}
		ol > li:before {
			content: counters(item, ".") ". ";
			display: table-cell;
			padding-right: 0.6em;
		}
		li ol > li {
			margin: 0;
		}
		li ol > li:before {
			content: counters(item, ".") " ";
		}

Gives something like: image

But would it be possible to compute and render these "addresses" and set them as value attribute in the created list? Like here https://www.w3schools.com/tags/att_li_value.asp

<li value="2.1">Übersicht</li>

Thanks in advance! Stay healty!

flaushi avatar Mar 29 '20 09:03 flaushi