Open In App

HTML | DOM Style listStyle Property

The Style listStyle Property in HTML DOM used to set up to three list properties namely

Syntax:



object.style.listStyle
object.style.listStyle = "type position image|initial|inherit"

Property Values:

Return Value:



Example-1: 




<!DOCTYPE html>
<html>
 
<head>
    <title>DOM Style listStyle Property </title>
    <style>
 
    </style>
 
</head>
 
<body>
 
    <h1 style="color:green;width:40%;">
                GeeksForGeeks
            </h1>
    <h2>DOM Style listStyle Property </h2>
   
    <ul id="gfg">
        <li>C</li>
        <li>C++</li>
        <li>Python</li>
        <li>Java</li>
    </ul>
 
    <button type="button" onclick="geeks()">
        Change ListStyle
    </button>
 
    <script>
        function geeks() {
           
            //  Set listStyle in square.
            document.getElementById(
              "gfg").style.listStyle =
              "square inside";
        }
    </script>
 
</body>
 
</html>

Output:

 

 

Example-2: 




<!DOCTYPE html>
<html>
 
<head>
    <title>DOM Style listStyle Property </title>
    <style>
 
    </style>
 
</head>
 
<body>
 
    <h1 style="color:green;width:40%;">
                GeeksForGeeks
            </h1>
    <h2>DOM Style listStyle Property </h2>
   
    <ul id="gfg">
        <li>C</li>
        <li>C++</li>
        <li>Python</li>
        <li>Java</li>
    </ul>
 
    <button type="button" onclick="geeks()">
        Change ListStyle
    </button>
 
    <script>
        function geeks() {
           
            // set listStyle in decimal.
            document.getElementById(
              "gfg").style.listStyle =
              "decimal inside";
        }
    </script>
 
</body>
 
</html>

Output:

 

 

Supported Browsers: The browser supported by DOM Style listStyle property are listed below:


Article Tags :