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
Release: 2024-11-26 06:03:10
Original
259 people have browsed it

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;
}
Copy after login

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>
Copy after login

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!

source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template