As we have already seen in HTML Lists, lists provides you a way to represent list of elements in an HTML page.
And in CSS we can apply styles to the HTML List.
CSS provides set of properties using which styles can be applied to the Lists.
Usually unordered lists(i.e. Using <ul> tag) in HTML are represented with a black circle in front.
<html> <body> <ul> <li>London</li> <li>Delhi</li> <li>Washington</li> </ul> </body> </html>
So, in the above example, we have defined an unordered list using <ul> tag.
<ul> <li>London</li> <li>Delhi</li> <li>Washington</li> </ul>
And if you see the above output, we can see the black circular bullets for the unordered lists.
Now, if you want to change the default black circular bullets for the unordered lists, you can use the list-style-type property.
Let us say, we want a black square for the unordered lists.
<html> <head> <style> ul { list-style-type: square; } </style> </head> <body> <ul> <li>London</li> <li>Delhi</li> <li>Washington</li> </ul> </body> </html>
So, in the above example, we have defined the value of list-style-type as square. And we want black square as bullets for the unordered lists.
Similarly, if we want white circle with black borders as bullets for unordered lists, we can use the value circle for list-style-type property.
<html> <head> <style> ul { list-style-type: circle; } </style> </head> <body> <ul> <li>London</li> <li>Delhi</li> <li>Washington</li> </ul> </body> </html>
Similarly, we can use list-style-type property for Ordered List.
Usually, the default implementation of Ordered Lists(i.e. Using <ol> tag) are numeric values(i.e. 1, 2 and so on).
To change the default implementation, we can use list-style-type property and set its value accordingly.
<html> <head> <style> ol { list-style-type: lower-alpha; } </style> </head> <body> <ol> <li>London</li> <li>Delhi</li> <li>Washington</li> </ol> </body> </html>
So, in the above example, we have set the value of list-style-type property as lower-alpha.
<style> ol { list-style-type: lower-alpha; } </style>
And we get the rest as letters as lower case as list markers.
Similarly we can use image as markers for the lists in CSS.
<html> <head> <style> ul { list-style-image: url('images/learnerslesson_logo.png'); } </style> </head> <body> <ul> <li>London</li> <li>Delhi</li> <li>Washington</li> </ul> </body> </html>
So, if you look at the above output, we got the image as marker for the unordered list(i.e. <ul>).
And that is because we have set the value of list-style-image property as the image(i.e. learnerslesson_logo.png).
<style> ul { list-style-image: url('images/learnerslesson_logo.png'); } </style>
As said earlier in this tutorial, the default marker for unordered lists(i.e. Using <ul> tag) in HTML is using a black circle in front.
If you want to remove it completely from the List then set the value of list-style-type to none.
<html> <head> <style> ul { list-style-type: none; } </style> </head> <body> <ul> <li>London</li> <li>Delhi</li> <li>Washington</li> </ul> </body> </html>
So, if you look at the above output, there is no marker at the front of the list.
That is because we have set the value of list-style-type to none.
<style> ul { list-style-type: none; } </style>