Ordered Lists in HTML: Lower-Alpha with Right Parentheses
The standard ordered list type for "lower-alpha" uses a period "." as the list marker. Is there a way to modify this to use a right parenthesis instead, resulting in a sequence like a)... b) etc.?
Solution
CSS offers a feature called counters, which allows for the automatic creation of sequences such as chapter numbers. By adapting this concept, we can achieve our desired lower-alpha list with right parentheses.
Here's a code snippet:
ol { counter-reset: list; } ol > li { list-style: none; } ol > li:before { content: counter(list, lower-alpha) ") "; counter-increment: list; }
The "counter-reset" property initializes a counter named "list" for the ordered list. "list-style: none;" removes the native list symbols.
The key step is the "li:before" selector. It inserts content before each list item:
The resulting list will appear as follows:
`Custom list style type (v1):
The above is the detailed content of How Can I Create an HTML Ordered List with Lower-Alpha Markers and Right Parentheses?. For more information, please follow other related articles on the PHP Chinese website!