This should be achievable with the list-style-type CSS property. Try out this code below, and see if this is working how you would like:

.name-list {
  list-style-type: upper-alpha;
}
<ol class="name-list">
  <li>Bill</li>
  <li>Steve</li>
  <li>William</li>
</ol>
Answer from Jeith on Stack Overflow
🌐
W3Schools
w3schools.com › html › html_lists_ordered.asp
HTML Ordered Lists
Use the HTML <ol> element to define an ordered list · Use the HTML type attribute to define the numbering type ... For a complete list of all available HTML tags, visit our HTML Tag Reference.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › HTML › Reference › Elements › ol
<ol>: The Ordered List element - HTML | MDN
The <ol> HTML element represents an ordered list of items — typically rendered as a numbered list.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Learn_web_development › Core › Text_styling › Styling_lists
Styling lists - Learn web development | MDN
The three properties mentioned above can all be set using a single shorthand property, list-style. For example, the following CSS: ... The values can be listed in any order, and you can use one, two, or all three (the default values used for the properties that are not included are disc, none, and outside).
🌐
Shay Howe
learn.shayhowe.com › html-css › creating-lists
Creating Lists - Learn to Code HTML & CSS
Unordered and ordered lists use list item markers by default. For unordered lists these are typically solid dots, while ordered lists typically use numbers. With CSS the style and position of these list item markers may be adjusted.
🌐
Tutorial Republic
tutorialrepublic.com › css-tutorial › css-lists.php
Formatting Unordered and Ordered Lists Using CSS - Tutorial Republic
In this tutorial you will learn how to format HTML lists using CSS. ... Unordered lists — A list of items, where every list items are marked with bullets. Ordered lists — A list of items, where each list items are marked with numbers.
🌐
Josh W. Comeau
joshwcomeau.com › css › styling-ordered-lists-with-css-counters
Styling Ordered Lists with CSS Counters
CSS has a pretty nifty trick up its sleeve to deal with this situation. It has a built-in counter mechanism. ... ol li { counter-increment: muffins; } ol li:before { content: counter(muffins) ". "; } ol { list-style: none; counter-reset: muffins; }
🌐
W3Schools
w3schools.com › tags › tag_ol.asp
HTML ol tag
The <ol> tag defines an ordered list. An ordered list can be numerical or alphabetical. The <li> tag is used to define each list item. Tip: Use CSS to style lists. Tip: For unordered list, use the <ul> tag.
🌐
W3Schools
w3schools.com › css › css_list.asp
CSS Styling Lists
The list-style property is a shorthand property. It is used to set all the list properties in one declaration. When using the shorthand property, the order of the property values are:
Find elsewhere
🌐
DhiWise
dhiwise.com › post › guide-to-creating-structure-content-using-html-ordered-lists
Creating Structured Content with HTML Ordered List
June 4, 2024 - This CSS will create a hierarchical numbering system for nested lists and add some indentation for sub-lists. While HTML provides the structure for ordered lists, CSS takes them to the next level by offering a wide range of styling options.
🌐
GeeksforGeeks
geeksforgeeks.org › html › html-ordered-lists
HTML Ordered Lists - GeeksforGeeks
July 23, 2025 - This is how the HTML Ordered list will be displayed in a browser: ... The list is automatically numbered by the browser, but the style of numbering can be adjusted using attributes and CSS.
🌐
Mark
mark.ie › blog › nested-lists-in-css-with-a-numbered-hierarchy
Nested lists in CSS with a numbered hierarchy | Mark Conroy | Lead Frontend Drupal Developer
First, we need to ensure our HTML has the right structure. Here’s an example of what a nested ordered list should look like: <ol> <li>Main Item 1 <ol> <li>Sub-item 1.1</li> <li>Sub-item 1.2</li> </ol> </li> <li>Main Item 2 <ol> <li>Sub-item 2.1</li> </ol> </li> </ol> ... The outer <ol> represents the main list. Each <li> inside it represents a main item. Nested <ol> tags represent sub-items. Now, let's apply CSS to format these numbers!
🌐
GeeksforGeeks
geeksforgeeks.org › css › css-lists
CSS Lists - GeeksforGeeks
June 12, 2018 - Ordered List: In ordered lists, the list items are marked with numbers and an alphabet. We have the following CSS lists properties, which can be used to control the CSS lists: Now, we will learn more about these properties with examples.
🌐
DevJunky
devjunky.com › Creating-an-Ordered-list-with-Numbers-and-Letters-combined
Creating an Ordered list with Numbers and Letters combined
May 8, 2025 - Changing the CSS property list-style-type to either/both <ul> (Unordered List) and <ol> (Ordered List) will change how the listing will show in the browser. Change the value of the input below to see how each property values are shown in the browser.
🌐
freeCodeCamp
freecodecamp.org › news › html-list-how-to-use-bullet-points-ordered-and-unordered-lists
HTML List – How to Use Bullet Points, Ordered, and Unordered Lists
July 1, 2021 - We can define the list items using the <li> tag. Here is the complete HTML structure for an ordered list:
🌐
Mimo
mimo.org › glossary › html › ordered-lists
HTML ol Tag: The Ordered List Element
The <ul> tag creates an unordered or bulleted list in HTML. Unlike ordered lists, HTML unordered lists use bullet points as markers. They’re especially useful in scenarios where the order of list items doesn't matter. ... You can use CSS to style and customize the appearance of your ordered lists.
🌐
W3Schools
w3schools.com › html › html_lists.asp
HTML Lists
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, XML and more.
Top answer
1 of 13
371

None of solutions on this page works correctly and universally for all levels and long (wrapped) paragraphs. It’s really tricky to achieve a consistent indentation due to variable size of marker (1., 1.2, 1.10, 1.10.5, …); it can’t be just “faked,” not even with a precomputed margin/padding for each possible indentation level.

I finally figured out a solution that actually works and doesn’t need any JavaScript.

It’s tested on Firefox 32, Chromium 37, IE 9 and Android Browser. Doesn't work on IE 7 and previous.

CSS:

ol {
  list-style-type: none;
  counter-reset: item;
  margin: 0;
  padding: 0;
}

ol > li {
  display: table;
  counter-increment: item;
  margin-bottom: 0.6em;
}

ol > li:before {
  content: counters(item, ".") ". ";
  display: table-cell;
  padding-right: 0.6em;    
}

li ol > li {
  margin: 0;
}

li ol > li:before {
  content: counters(item, ".") " ";
}

Example:

ol {
  list-style-type: none;
  counter-reset: item;
  margin: 0;
  padding: 0;
}

li {
  display: table;
  counter-increment: item;
  margin-bottom: 0.6em;
}

li:before {
  content: counters(item, ".") ". ";
  display: table-cell;
  padding-right: 0.6em;
}

li li {
  margin: 0;
}

li li:before {
  content: counters(item, ".") " ";
}
<ol>
  <li>Lorem ipsum.</li>
  <li>Excepteur sint occaecat cupidatat non proident:
    <ol>
      <li>sunt in culpa qui officia,</li>
      <li>deserunt mollit anim id est laborum.</li>
    </ol>
  </li>
  <li>Ut enim ad minim veniam.
    <ol>
      <li>Quis nostrud exercitation.</li>
      <li>Ullamco laboris nisi ut.
        <ol>
          <li>
            Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
          </li>
        </ol>
      </li>
    </ol>
  </li>
  <li>At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia
    animi.</li>
</ol>

Try it on JSFiddle, fork it on Gist.

2 of 13
368

You can use counters to do so:

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 }

Example

ol { counter-reset: item }
li{ display: block }
li:before { content: counters(item, ".") " "; counter-increment: item }
<ol>
  <li>li element
    <ol>
      <li>sub li element</li>
      <li>sub li element</li>
      <li>sub li element</li>
    </ol>
  </li>
  <li>li element</li>
  <li>li element
    <ol>
      <li>sub li element</li>
      <li>sub li element</li>
      <li>sub li element</li>
    </ol>
  </li>
</ol>

See Nested counters and scope for more information.

🌐
Smashing Magazine
smashingmagazine.com › 2019 › 07 › css-lists-markers-counters
CSS Lists, Markers, And Counters — Smashing Magazine
Lists in CSS have particular properties which give us the standard list styling we expect. An unordered list gains a list bullet, of the type disc, and ordered lists are numbered. My interest in exploring lists in more detail came from some work I did to document the ::marker pseudo-element for MDN.