HTML | DOM Style listStylePosition Property
The DOM Style listStylePosition property sets or returns the position of the list-item marker.
Syntax :
- For set the listStylePosition property:
object.style.listStylePosition = value
- For return the listStylePosition property:
object.style.listStylePosition
Return Value: This return a String that representing the position of the list-item marker.
Values:
| Value | Description |
|---|---|
| outside | This is default and specifies that list-item marker will be rendered before any text content. |
| inside | This indents the list-item marker. |
| initial | This sets this property to its default value. |
| inherit | This inherits this property from its parent element. |
Example-1: Use of “inside” value.
<!DOCTYPE html> <html> <head> <title> HTML | DOM Style listStylePosition Property </title> <style> li { background-color: lightgreen; } div { padding: 20px; width: 70%; heinght: 40%; border: 2px solid green; } </style> </head> <body> <div> <p>Welcome to GeekforGeeks.!</p> <ul id="mainUL"> <li>item_1</li> <li>item_2</li> <li>item_3</li> </ul> </div> <br> <input type="button" value="click Me.!" onclick="mainFunction()" /> <script> function mainFunction() { // set position 'inside' document.getElementById( "mainUL").style.listStylePosition = "inside"; } </script> </body> </html> |
Output :
- Before click:

- After Click:

Example-2: Use of “outside” value. Since this is default value so we can check by simply return The list-style-position property.
<!DOCTYPE html> <html> <head> <title> HTML | DOM Style listStylePosition Property </title> <style> div { padding: 20px; width: 70%; height: 40%; border: 2px solid green; } </style> </head> <body> <div> <p>Welcome to GeekforGeeks.!</p> <!-- set position 'outside' --> <ul id="mainList" style="list-style-position:outside;"> <li>item_1</li> <li>item_2</li> <li>item_3</li> </ul> <br> <input type="button" value="click Me.!" onclick="mainFunction()" /> </div> <script> function mainFunction() { // Return position using alert. alert(document.getElementById( "mainList").style.listStylePosition); } </script> </body> </html> |
Output :


Supported Browsers: The browser supported by HTML | DOM Style listStylePosition Property are listed below:
- Google Chrome
- Edge
- Mozilla Firefox
- Opera
- Safari
Recommended Posts:
- HTML | DOM Style top Property
- HTML | DOM Style right Property
- HTML | DOM Style animationTimingFunction Property
- HTML | DOM Style textDecorationStyle Property
- HTML | DOM Style cursor Property
- HTML | DOM Style animationDirection Property
- HTML | DOM Style visibility Property
- HTML | DOM Style transitionProperty Property
- HTML | DOM Style isolation Property
- HTML | DOM Style filter Property
- HTML | DOM Style clear Property
- HTML | DOM Style columnFill Property
- HTML | DOM Style objectFit Property
- HTML | DOM Style columns Property
- HTML | DOM Style borderBottomColor Property
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.



