Style listStylePositionProperty
Style Object
Definition and Usage
The listStylePosition property sets or returns the position of the list item marker.
Syntax
Set the listStylePosition property:
Object.style.listStylePosition="outside|inside|inherit"
Return the listStylePosition property:
Object.style.listStylePosition
| Value | Description |
|---|---|
| outside | Default. List item markers are rendered before any text content. The list item marker is placed outside the text, and wrapping text is not aligned with the marker. |
| inside | Indent the list item marker. The list item marker is placed inside the text, and wrapping text is aligned with the marker. |
| inherit | The value of the listStylePosition property is inherited from the parent element. |
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the listStylePosition property.
Note:IE7 and earlier versions do not support the "inherit" value. IE8 supports "inherit" only if a !DOCTYPE is specified. IE9 supports "inherit".
Example
Example
Indent the list item marker by clicking the button:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Rookie Tutorial (example.com)</title>
<script>
function displayResult(){
document.getElementById("ul1").style.listStylePosition="inside";
}
</script>
</head>
<body>
<ul id="ul1">
<li>Coffee</li>
<li>Tea</li>
<li>Water</li>
<li>Soda</li>
</ul>
<br>
<button type="button" onclick="displayResult()">Indent the list item markers</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Rookie Tutorial (example.com)</title>
<script>
function displayResult(){
document.getElementById("ul1").style.listStylePosition="inside";
}
</script>
</head>
<body>
<ul id="ul1">
<li>Coffee</li>
<li>Tea</li>
<li>Water</li>
<li>Soda</li>
</ul>
<br>
<button type="button" onclick="displayResult()">Indent the list item markers</button>
</body>
</html>
Try it Yourself »
Style Object Other Extensions