How to get list item (
  • ) marker/label declared in list-style-type?
  • 后端 未结 1 2001
    野的像风
    野的像风 2020-12-15 07:34

    Lets say I have a list like this:

    • Lorem
    • Ipsum
    <
    相关标签:
    1条回答
    • 2020-12-15 08:18

      Is there a way to get this letter for any given list item?

      Yes. You can read the list-style-type and generate what characters are showing for each style type. Which character is shown for a specific item number and style type could vary across browsers though.

      Or, maybe there is way to extract markers from style?

      No. (At least not currently)

      Some useful stuff for writing a generator:

      • List of Unicode characters
      • List-generator in all list-style-types
      • Numbers to roman numerals in Javascript

      Also, many of the list-styles are uppercase versions of other list styles. Could be good to know then that myString.toUpperCase() works on unicode characters as well. :)

      0 讨论(0)
    提交回复
    热议问题