List Style Type in CSS

Learn via video course
FREE
View all courses
JavaScript Course With Certification: Unlocking the Power of JavaScript
JavaScript Course With Certification: Unlocking the Power of JavaScript
by Mrinal Bhattacharya
1000
4.8
Start Learning
JavaScript Course With Certification: Unlocking the Power of JavaScript
JavaScript Course With Certification: Unlocking the Power of JavaScript
by Mrinal Bhattacharya
1000
4.8
Start Learning
Topics Covered

Overview

The "list-style-type" property in CSS specifies the appearance of the list item marker (such as a disc, character, or custom style). This article will discuss various list style type CSS values along with their syntax and examples.

Syntax

The syntax for the list style type CSS property is as follows :

list-style-type in CSS

The list style type CSS property can be defined using any of the following values :

1. <custom-ident>

The <custom-ident> is a data type in CSS that describes a custom identifier pre-defined by the user of the style sheet. It is an identifier similar to the value of a @counter-style or any of its pre-defined styles.

How to name <custom-ident> Values ?

A <custom-ident> can include the following characters :

  1. Any alphabetical character (A to Z, or a to z).
  2. Any decimal digit (0 to 9)
  3. A hyphen (-).
  4. An underscore (_).
  5. an escaped character preceded by a backslash ().
  6. A Unicode character (in the format of a backslash followed by one to six hexadecimal digits, representing its Unicode code point).

Rules to keep in mind while naming a <custom-ident> :

  1. We can not use a digit as the first character unless it is escaped.
  2. We cannot start with a hyphen which is then followed by a decimal digit.
  3. Cannot start with two hyphens.
  4. <custom-ident> is case-sensitive.
  5. Wide keywords in CSS are not valid <custom-ident>. Therefore, we cannot inherit, initial, or unset identifiers.
  6. The default keyword is not a valid <custom-ident>.
  7. Excluded keywords are excluded in all ASCII case permutations. So default, Default, and DEFAULT should not be used.
  8. We cannot wrap <custom-ident> within quotes. Otherwise, it will be interpreted as a string instead of an identifier.

Below is the implementation for <custom-ident> :

Output :

custom-indent-property-in-css


2. Disc

The disc is the default value for the property. The marker is a filled circle in this style type.

Syntax :

Example :

Output :

disc-style-of-list


3. Circle

In this style type, the marker is a hollow circle.

Syntax :

Example :

Output :

circle-style-of-list


4. Square

In this style type, the marker is a filled square.

Syntax :

Example :

Output :

square-style-of-list


5. Decimal

In this style type, a marker is a Decimal number beginning with 1.

Syntax :

Example :

Output : decimal-style-of-list


6. lower-roman

In this style type, the marker is a lowercase roman numeral.

Syntax :

Example :

Output :

lower-roman-style-of-list


7. upper-roman

In this style type, the marker is an uppercase Roman numeral.

Syntax :

Example :

Output : upper-roman-style-of-list


8.lower-greek

In this style type, the marker is a lowercase classical Greek.

Syntax :

Example :

Output : lower-geek-style-of-list


9. lower-latin

In this style type, the marker is a lowercase ASCII letter (a,b,c,z)(a, b, c, … z).

Syntax :

Example :

Output : lower-latin-style-of-list


10. upper-latin

In this style type, the marker is an uppercase ASCII letter (A,B,C,Z)(A, B, C, … Z).

Syntax :

Example :

Output : upper-latin-style-of-list

lower-alpha and upper-alpha are similar to lower-latin and upper-latin in Internet Explorer 7.

Now, let us look at some other types of CSS list styles in a tabulated manner :

ValueDescription
noneNo marker is shown
decimal-leading-zerodecimal numbers with leading zeroes
arabic-indicarabic Indic numbers
armeniantraditional Armenian numbers
bengaliBengali numbering
cambodian/khmercambodian/Khmer numbers
devanagariDevanagari numbers
ethiopic-numericEthiopian numbers
gerogiantraditional Georgian number
gujratigujrati numbering
gurmukhigurmukhi numbering
hebrewtraditional Hebrew numbers
hiraganadictionary order hiragana numbers
japanese-formalJapanese formal numbers used in legal documents.
japanese-informalJapanese informal numbers
kannadaKannada numbering
katakanaDictionary-order katakana lettering
korean-hangul-formalkorean hangul numbering
korean-hanja-informalKorean informal numbering
laoLatin numbering
lower-armenianlowercase armenian numbers
malayalammalyalam numbers
mongolianMongolian numbering
myanmarMyanmar (Burmese) numbering
oriyaoriya numbering
persianPersian numbers
simp-chinese-formalsimplified Chinese formal numbers
simp-chinese-informalsimplified Chinese informal numbers
tamilTamil numbering
teluguTelugu numbering
thaiThai numbers
tibetianTibetian numbering
trad-chinese-formaltraditional chinese formal numbering
trad-chinese-informaltraditional chinese formal numbering
upper-armeniantraditional uppercase Armenian numbering
disclosure-openmarker indicating a disclosure widget that is opened
disclosure-closedmarker indicating a disclosure widget that is closed

Examples

Now let us discuss the " list style type" CSS property with the help of examples and learn how to use this property in CSS.

Setting List Item Markers

In the above " list style type" CSS example, we chose to display uppercase roman numerals in front of each list item of the ordered list.

While for the unordered list, we removed the default disc marker from the front of each list item. The list items will still indent (unless overridden with CSS), but there will be nothing appearing before each list item.

Output :

setting-list-item-markers


All List Style Types

In this example, we will implement all the list style types in CSS and choose the required one with the help of radio buttons.

Output : all-list-style-type

Accessibility Concerns

Apple's VoiceOver screen reader faces an issue while working with unordered lists having a list-style-type value of none. As these lists won't be read out as a list, to address this issue, we have to add a zero-width space as pseudo content before each list item to ensure the list is read correctly.

The zero-width space character is encoded in Unicode as U+200B.

Browser Support

The following browsers support the "list style type" CSS property :

  1. Chrome
  2. Microsoft Edge
  3. Firefox
  4. Internet Explorer
  5. Opera
  6. Safari
  7. Chrome Android
  8. Firefox for Android
  9. Opera Android
  10. Safari on iOS
  11. Samsung Internet
  12. WebView Android

Conclusion

  • The list style type CSS property sets the appearance of the style used in the marker for a list item.
  • The list style type CSS property can be applied to <ol>, <ul>, or <li> tags and is used to elements with display: list-item.
  • Internet Explorer 7 does not support lower-latin and upper-latin; therefore, we use lower-alpha and upper-alpha as a replacement.
  • Alphabetical styles including lower-alpha and upper-alpha render undefined numbers after 26 item listing has been completed.

Also check out the list-style, list-style-image, and list-style-position CSS properties.