CSS ol sub numbering

Делаем списки для документов на CSS

--

Юридические документы, как правило, имеют пронумерованные пункты. При этом пункты могут содержать вложенные пункты. Можно, конечно, такие вещи сделать в ручную, но через CSS это может быть удобнее.

Собственно сам код очень прост:

ol { counter-reset: item }
ol > li { display: block }
ol > li:before {
content: counters(item, ".") ". ";
counter-increment: item
}

В итоге получаем такой вот документ:

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Fullstack CTO
Fullstack CTO

Written by Fullstack CTO

CTO and co-founder at NEWHR & Geekjob

No responses yet

Write a response