Style listStyleImageProperty

Style 对象参考手册Style Object

Definition and Usage

The listStyleImage property sets or returns the image used as a list-item marker.

Syntax

Set the listStyleImage property:

Object.style.listStyleImage="none|url|inherit"

Return the listStyleImage property:

Object.style.listStyleImage

Value Description
none Default. No image is displayed.
url Specifies the path to the image.
inherit The value of the listStyleImage property is inherited from the parent element.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the listStyleImage 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

Change the list-item marker of a list:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Rookie Tutorial (example.com)</title>
<script>
function displayResult(){
    document.getElementById("ul1").style.listStyleImage="url('sqorange.gif')";
}
</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()">Change list item marker</button>

</body>
</html>

Try it Yourself »


Style 对象参考手册Style Object Other Extensions