Lists have one other CSS specialty. You can use the list-style-type property to determine what label they use. If applied to an <li> tag, only that one list item will adopt the new label. But if this property is targeted at an <ol> or <ul> tag, every list item in that list will use that label. The tables below contain the most common value keywords for ordered and unordered lists. Note that it is still acceptable for ordered lists to set their labels using the “type” attribute, but the list-style-type property is the preferred method.
Value | Display |
decimal |
|
upper-alpha |
|
lower-alpha |
|
upper-roman |
|
lower-roman |
|
Value | Display |
disc |
|
circle |
|
square |
|
none |
|
You can even create a custom label by adding an image you designed via the list-style-image property. This property is expressed as list-style-image:url(“Name of Image Here”).You just need to add a link to the image you’d like to use inside quotation marks, like in the example below.
<style> <ul class="custom"> |
|
Don’t forget that you can add an id or class to your lists, and use that as your selector. This can be useful when you need some variety in your list styling.