Styling an ordered list, and putting the numbers inside the list item

123 views Asked by At

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

There are 1 answers

2
Praveen Kumar Purushothaman On

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 */
}