CSS | list-style Property

The list-style property in CSS is used to set the list style. This property is a combination of three other properties list-style-type, list-style-position, and list-style-image as can be used as a shorthand notation for these three properties.

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.It’s default value is disc.
  • list-style-position:This value sets the position of the marker relative to a list item.It’s default value is “outside”.
  • list-style-image:This value sets an image to be used as the list item marker. It’s default value is “none”.

Example 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
    <head>
    <title>
        CSS list-style Property
    </title>
    <style>
        ul {
        list-style: square inside 
        }
          
  
    </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>                    

chevron_right


Output:
liststyle

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!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>

chevron_right


Output:
liststyle
Note:If no list-style-image is specified than it is taken none.

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

  • Google Chrome 1.0
  • Internet Explorer 4.0
  • Firefox 1.0
  • Opera 7.0
  • Apple Safari 1.0


My Personal Notes arrow_drop_up


If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.