
- CSS Tutorial
- CSS - Home
- CSS - Introduction
- CSS - Syntax
- CSS - Inclusion
- CSS - Measurement Units
- CSS - Colors
- CSS - Backgrounds
- CSS - Fonts
- CSS - Text
- CSS - Images
- CSS - Links
- CSS - Tables
- CSS - Borders
- CSS - Margins
- CSS - Lists
- CSS - Padding
- CSS - Cursors
- CSS - Outlines
- CSS - Dimension
- CSS - Scrollbars
- CSS Advanced
- CSS - Visibility
- CSS - Positioning
- CSS - Layers
- CSS - Pseudo Classes
- CSS - Pseudo Elements
- CSS - @ Rules
- CSS - Text Effects
- CSS - Media Types
- CSS - Paged Media
- CSS - Aural Media
- CSS - Printing
- CSS - Layouts
- CSS - Validations
- CSS3 Tutorial
- CSS3 - Tutorial
- CSS3 - Rounded Corner
- CSS3 - Border Images
- CSS3 - Multi Background
- CSS3 - Color
- CSS3 - Gradients
- CSS3 - Shadow
- CSS3 - Text
- CSS3 - Web font
- CSS3 - 2d transform
- CSS3 - 3d transform
- CSS3 - Animation
- CSS3 - Multi columns
- CSS3 - User Interface
- CSS3 - Box Sizing
- CSS Responsive
- CSS - Responsive Web Design
- CSS References
- CSS - Questions and Answers
- CSS - Quick Guide
- CSS - References
- CSS - Color References
- CSS - Web browser References
- CSS - Web safe fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
Styling Lists with CSS
Lists are ordered as well unordered. With CSS, you can set the set list item markers or an image for the markers. With that, with CSS, we can also set the position for list-item markers.
Let us now see some examples −
list-style-type
The list-style-type is used to set the type of list-item marker.
Example
Let us now see an example wherein we are formatting ordered lists (ol) −
<!DOCTYPE html> <html> <head> <style> ul { list-style-type: upper-roman; } </style> </head> <body> <h2>Teams</h2> <ul> <li>India</li> <li>Australia</li> <li>England</li> <li>West Indies</li> <li>South Africa</li> <li>Srilanka</li> </ul> </body> </html>
Output
list-style-image
The list-style-image property is used to set an image as the list-item marker.
Example
Let us now see an example −
<!DOCTYPE html> <html> <head> <style> ul.demo1 { list-style-image: url('https://www.tutorialspoint.com/images/Swift.png'); } ol.demo2 { list-style-image: url('https://www.tutorialspoint.com/images/Swift.png'); } </style> </head> <body> <h2>Teams</h2> <ul class="demo1"> <li>India - Qualified for WordCup</li> <li>Australia - Qualified for WordCup</li> <li>England - Qualified for WordCup</li> </ul> <h2>Players</h2> <ol class="demo2"> <li>Virat Kohli</li> <li>David Warner</li> <li>Steve Smith</li> </ol> </body> </html>
Output
list-style-position
The list-style-position property is used to set the position of the list-item markers.
Example
Let us now see an example −
<!DOCTYPE html> <html> <head> <style> ul.demo1 { list-style-position: outside; } ul.demo2 { list-style-position: inside; } </style> </head> <body> <h1>Teams</h1> <h2>ODI Teams</h2> <ul class="demo1"> <li>India</li> <li>Australia</li> <li>England</li> <li>West Indies</li> <li>South Africa</li> <li>Srilanka</li> </ul> <h2>Test Teams</h2> <ul class="demo2"> <ul> <li>India</li> <li>Australia</li> <li>England</li> <li>West Indies</li> <li>South Africa</li> <li>Srilanka</li> </ul> </ul> </body> </html>
Output
- Related Articles
- Styling Lists in CSS
- Styling Links with CSS
- Styling Tables with CSS
- Styling Links Working with CSS
- Styling Tables Working with CSS
- Styling Forms with CSS Attribute Selectors
- Styling First-Letters with CSS ::first-letter
- Style unordered lists markers with CSS
- Chrome input type=“number” CSS styling
- Styling Background of Elements Using CSS
- Styling background of elements in CSS
- Essential CSS Properties for Styling Tables
- CSS Styling of File Upload Button with ::file-selector-button Selector
- Styling different states of a link using CSS
- How to use CSS Selectors for styling elements?

Advertisements