listStylePosition Property - Javascript CSS Style Property

Javascript examples for CSS Style Property:listStylePosition

Description

The listStylePosition property sets or gets the position of the list-item marker.

Property Values

Value Description
outside list-item marker is before text content. This is default
inside Indents the list-item marker marker
initial Sets this property to its default value.
inherit Inherits this property from its parent element.

Technical Details

Item Value
Default Value: outside?
Return Value: A String, representing the position of the list-item marker
CSS VersionCSS1

Get the list-item marker:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<ul id="myList" style="list-style-position:inside;">
  <li>Coffee</li>
  <li>Tea</li>
  <li>Water</li>
  <li>Soda</li>
</ul>/*www  .ja  v a  2  s . c  o  m*/

<button type="button" onclick="myFunction()">Return list-item marker position</button>

<script>
function myFunction() {
    console.log(document.getElementById("myList").style.listStylePosition);
}
</script>

</body>
</html>

Related Tutorials