Home >Web Front-end >CSS Tutorial >How to Create Ordered Lists with Lower-Alpha Numbering and Right Parentheses in HTML?

How to Create Ordered Lists with Lower-Alpha Numbering and Right Parentheses in HTML?

Patricia Arquette
Patricia ArquetteOriginal
2024-11-26 06:03:10276browse

How to Create Ordered Lists with Lower-Alpha Numbering and Right Parentheses in HTML?

Custom List Style in HTML: Right Parentheses for Ordered Lists

How can you create an ordered list with lower-alpha numbering but use right parentheses instead of the default dot?

Solution:

Leveraging CSS counters, here's a unique solution:

ol {
  counter-reset: list;
}
ol > li {
  list-style: none;
}
ol > li:before {
  content: counter(list, lower-alpha) ") ";
  counter-increment: list;
}

HTML Example:

<span>custom list style type (v1):</span>
<ol>
  <li>Number 1</li>
  <li>Number 2</li>
  <li>Number 3</li>
  <li>Number 4</li>
  <li>Number 5</li>
  <li>Number 6</li>
</ol>

With this method, you can customize your lists as desired. Simply adjust the "content" property to set the desired character after the list number.

The above is the detailed content of How to Create Ordered Lists with Lower-Alpha Numbering and Right Parentheses in HTML?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn