Home > Web Front-end > CSS Tutorial > How Can I Customize Ordered Lists in Firefox 3 (and Beyond)?

How Can I Customize Ordered Lists in Firefox 3 (and Beyond)?

Linda Hamilton
Release: 2024-12-09 02:20:08
Original
542 people have browsed it

How Can I Customize Ordered Lists in Firefox 3 (and Beyond)?

Customizing Ordered Lists in Firefox 3

Left-Aligning List Numbers

To left-align the numbers in an ordered list, you can use CSS to override the default styling:

ol {
  counter-reset: item;
  margin-left: 0;
  padding-left: 0;
}

li {
  display: block;
  margin-bottom: .5em;
  margin-left: 2em;
}

li::before {
  display: inline-block;
  content: counter(item) ") ";
  counter-increment: item;
  width: 2em;
  margin-left: -2em;
}
Copy after login

Changing Character After List Numbers

To change the character after the list number, modify the content property in the li::before rule:

li::before {
  ...
  content: counter(item) "a) ";
  ...
}
Copy after login

Converting to Alphabetic/Roman Lists

To convert from numbers to alphabetic or roman lists using CSS, use a combination of counter-reset, counters() function, and content property:

ol {
  list-style-type: none;
  counter-reset: my-counter;
}

li {
  display: block;
  counter-increment: my-counter;
}

li::before {
  content: counters(my-counter, lower-alpha) ". ";
  ...
}
Copy after login

For Roman numerals:

li::before {
  content: counters(my-counter, lower-roman) ". ";
  ...
}
Copy after login

Note that this technique may not work in older browsers, including Internet Explorer 7.

The above is the detailed content of How Can I Customize Ordered Lists in Firefox 3 (and Beyond)?. 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