The Wayback Machine - https://web.archive.org/web/20240118180001/https://www.geeksforgeeks.org/css-list-style-property/
Open In App
Related Articles

CSS list-style Property

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

The list-style property in CSS is used to set the list style. This property is a combination of three other properties, namely, list-style-type, list-style-position, and list-style-image, which can be used as a shorthand notation for these three properties. The default value of this property will be used if any one of the values is missed.

Syntax:

list-style: list-style-type list-style-position list-style-image|initial|inherit;

Property values:

  • list-style-type: This value sets the marker (such as a disc, character, or custom counter style) of a list item element. Its default value is a disc.
  • list-style-position: This value sets the position of the marker relative to a list item. Its default value is “outside”.
  • list-style-image: This value sets an image to be used as the list item marker. Its default value is “none”.

We will understand the concepts of list-style property through the examples.

Example 1: This example illustrates the use of the list-style property where the position value is set to inside.

HTML




<!DOCTYPE html>
<html>
<head>
    <title> CSS list-style Property </title>
    <style>
        ul {
            list-style: square inside url(
        }
    </style>
</head>
 
<body>
    <h1 style="color:green;">
        GeeksforGeeks
    </h1>
    <h2>
        CSS list-style Property
    </h2>
 
    <p>Sorting Algorithms</p>
 
    <ul>
        <li>Bubble Sort</li>
        <li>Selection Sort</li>
        <li>Merge Sort</li>
    </ul>
</body>
</html>


Output:

liststyle

Example 2: This example illustrates the use of the list-style property where the position value is set to outside.

HTML




<!DOCTYPE html>
<html>
<head>
    <title> CSS list-style Property </title>
    <style>
        ul {
            list-style: square outside;
        }
    </style>
</head>
 
<body>
    <h1 style="color:green;">
        GeeksforGeeks
    </h1>
    <h2>
        CSS list-style Property
    </h2>
 
    <p>Sorting Algorithms</p>
 
    <ul>
        <li>Bubble Sort</li>
        <li>Selection Sort</li>
        <li>Merge Sort</li>
    </ul>
</body>
</html>


Output:

liststyle

Note: If no list-style-image is specified then it will be taken as none.

Supported Browsers: The browser supported by the list-style property are listed below:

  • Google Chrome 1.0
  • Internet Explorer 4.0
  • Microsoft Edge 12.0
  • Firefox 1.0
  • Opera 7.0
  • Safari 1.0

Learn to code easily with our course Coding for Everyone. This course is accessible and designed for everyone, even if you're new to coding. Start today and join millions on a journey to improve your skills!

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore.
Last Updated : 13 Jun, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads
Complete Tutorials