HTML: ordered sublists

2019-01-29 02:54发布

问题:

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?

回答1:

Counter's are the way to go. See this fiddle which goes three levels deep.



回答2:

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



回答3:

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.