list-style-type

The list-style-type
property is used for changing the marker type. This property can be applied to both <ul>
unordered list elements and <ol>
ordered list elements.
Unordered List Marker
You can set different shapes for unordered list markers. The default marker type for the unordered list is disc
. When the list is nested under another list, markers change to circle
and square
.
These are examples of markers for the unordered list.

Ordered List Marker
Many numbers and letters are available for ordered list markers including letters in different languages. The default marker type for the ordered list is decimal.
These are examples of markers for the ordered list.

list-style-type: none
You may want to eliminate list markers. In that case, you can set none
for the list-style-type
property. This is an example when you set list-style-type: none
.

Practice
Objective:
Check various list style types
1. Create a new HTML file for this chapter
- Create a copy of the chapter15.html file and change the name to chapter16.html.
- Change the
<title>
section to 16.CSS: Styling Lists. - Also, delete the existing content of the
<body>
element that was created in the previous chapter. - Add the
<h1>
tag to show the chapter title of this page at the top of the page. - The code should look like the one below.
2. Update the body section
Add the code below in the <body>
section of the HTML file. We are adding various list styles with the list-container
and item
classes. As this is a very long code, you can copy the code and paste it into your HTML file.
3. Update the CSS file
Open the practice.css file and add new code to add styles to the list-container
and item
classes. As this is the start of the chapter, add a comment upfront for code readability.
4. Check the result with a browser
- Open chapter15.html with a browser.
- You can see various list style types.
You can also check the sample result here (Demo Site).