You are here: Reference > JavaScript > client-side > style handling > properties > listStylePosition
listStylePosition style property
Specifies or returns whether the list marker for a list item should appear inside or outside the list-item box.
Syntax:
You can find the related objects in the Supported by objects section below.
This property is read/write.
CSS page for this property: list-style-position |
Possible values:
The type of this property is string.
One of the following values:
Takes the value of this property from the computed style of the parent element. | |||||||
List-marker is inside the text, and wrapped text content will be rendered at an indentation level similar to the marker. | |||||||
Default. The list-marker will be rendered before any text content. |
Default: outside.
Example HTML code 1:
This example illustrates the use of the list-style-position property:
|
||||
<body> <ol style="list-style-position: inside;"> <li>inside <li>list <li>position </ol> <ol style="list-style-position: outside;"> <li>outside <li>list <li>position </ol> </body> |
||||
|
||||
Did you find this example helpful?
|
Example HTML code 2:
This example illustrates the use of the listStylePosition property in JavaScript:
|
||||
<head> <script type="text/javascript"> function ChangeListStyle (selectTag) { // Returns the index of the selected option var whichSelected = selectTag.selectedIndex; // Returns the selected options values var listValue = selectTag.options[whichSelected].text; var oList = document.getElementById ("myOlist"); oList.style.listStylePosition = listValue; } </script> </head> <body> <ol id="myOlist"> <li>Apple <li>Pear <li>Peach </ol> <br /> <select onchange="ChangeListStyle (this);" size="2"> <option />inside <option selected="selected" />outside </select> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
Related pages:
External links:
list-style-position (MSDN)
list-style-position (Mozilla Developer Center)
list-style-position (Safari Reference Library)
list-style-position (W3C)
list-style-position (Mozilla Developer Center)
list-style-position (Safari Reference Library)
list-style-position (W3C)
User Contributed Comments