HTML: ordered sublists

2019-01-29 03:09发布

I want to create a ordered html list like this:

1.0 Introduction

1.1 Features

1.2 Readme

1.3 Thanks

...

How do I do this with html?

3条回答
Lonely孤独者°
2楼-- · 2019-01-29 03:12
Summer. ? 凉城
3楼-- · 2019-01-29 03:28

Your question is answered here

Can ordered list produce result that looks like 1.1, 1.2, 1.3 (instead of just 1, 2, 3, ...) with css?

The following style sheet numbers nested list items as "1", "1.1", "1.1.1", etc.

OL { counter-reset: item }
LI { display: block }
LI:before { content: counters(item, ".") " "; counter-increment: item }

Maybe you can edit your question to avoid duplicating questions. Pointing to that one I just told you.

查看更多
Melony?
4楼-- · 2019-01-29 03:34

You'll need to use the CSS counter-increment (and possibly the counter-reset) property.

http://www.w3schools.com/cssref/pr_gen_counter-increment.asp

查看更多
登录 后发表回答