I want to create an ordered list, break it (i.e. write some paragraph) and then continue the same ordered list, from the number where I left. Something like this:
List starts here:
- Item 1
- Item 2
This line is not a part of the ordered list.
- Item 3
- Item 4
- Item 5
I tried many methods after research. One of them that I found interesting is:
List starts here:
<ol class="begin">
<li>Item 1</li>
<li>Item 2</li>
</ol>
This line is not a part of the ordered list.
<ol class="continue">
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
</ol>
But this won’t work for me. This is the output that I get when I post this code in wordpress:
Is there any way of continuing a previous ordered list in html?
I want to continue ordered list automatically without using start=”n” tag.
Use
<ol start="3">
to achieve what you are looking for.For instance,
The Code:
Live:
Demo link
Hope this helps.
Edit:
If you do not want to hard-code, then you can do as below.
The code:
Live:
Demo link 2
Just in case, if you want the
p
to be out of the number indent, then you need to declare atext-indent
with corresponding indent value.Live:
Demo – 3
Additionally, if you want that to remain inside the DOM and do not break for small screens, use the below code.
Live:
Demo – 4