0

I'm wondering if it's possible to do accomplish an effect similar to the screenshot below using <ol> in HTML.

I want each white bubble to be a <li> in the <ol>, that way if I change their order in the HTML, the numbers will update automatically. I cant figure out how to put the number inside the list item itself, and to prepend "Example #" before it.

Example of what I want to do

1 Answer 1

2

You need to use CSS counters for this.

body { counter-reset: section; /* Set the section counter to 0 */ } h3::before { counter-increment: section; /* Increment the section counter*/ content: "Section" counter(section) ": "; /* Display the counter */ } 
Sign up to request clarification or add additional context in comments.

2 Comments

Counters is the best suited for this one because the counter value can also be used for the content. +1
You can do this with the ol/li, without ::before or ::after, but I believe it only works on mozilla.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.