listStyle Property - Javascript CSS Style Property

Javascript examples for CSS Style Property:listStyle

Description

The listStyle property sets or gets three separate list properties in a shorthand form.

  • list-style-type
  • list-style-position
  • list-style-image

Property Values

Parameter Description
type list-item marker type
position Positions the list-item marker
image an image to be used as the list-item marker
initial Sets this property to its default value.
inherit Inherits this property from its parent element.

Technical Details

Item Value
Default Value: disc outside none
Return Value: A String, representing the style of a list
CSS VersionCSS1

Get the style of a list:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<ul id="myList" style="list-style-type:circle;">
  <li>Coffee</li>
  <li>Tea</li>
  <li>Water</li>
  <li>Soda</li>
</ul>/*from w ww  .  ja  va2  s. c om*/

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

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

</body>
</html>

Related Tutorials