Open In App

How to create bullets using <li> elements ?

We know that, whether it may be an ordered list or unordered list they come along with a numbering.

It may be:



There are numerous options that we can use, but the question comes what property does this depend upon?

In CSS, for tags like <ol> and <ul>, there is a property called list-style-type.

Approach: The list-style-type property determines whether bullets, squares, or decimal etc come with li elements. To change or understand how it impacts the HTML is to use CSS targeting the selector <ul> or <ol>.



Syntax: CSS targeting <li> elements:

ol {
    list-style-type: decimal
}
ul {
    list-style-type: disc
}    

Let’s understand with examples:

 
  1. The default list-style-type for ordered list is Decimal and unordered is Disc. As evident from the above code.
  • Now we know from where bullets come in list elements, we can change it accordingly. Let’s set it to Roman Numerals in Ordered List and Square in Unordered List.
    1. upper-alpha
    2. lower-alpha
    3. none
    4. circle
    5. and many more….


    Article Tags :