listStyleImage Property - Javascript CSS Style Property

Javascript examples for CSS Style Property:listStyleImage

Description

The listStyleImage property sets or gets an image as the list-item marker.

Property Values

Value Description
noneNo image is used. Default
url Specifies the path to the image
initial Sets this property to its default value.
inherit Inherits this property from its parent element.

Technical Details

Item Value
Default Value: none
Return Value: A String, representing the location path of the image
CSS VersionCSS1

Specify an image as the list-item marker in a list:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<ul id="myList" style="list-style-image:url('http://java2s.com/resources/c.png');">
  <li>Coffee</li>
  <li>Tea</li>
  <li>Water</li>
  <li>Soda</li>
</ul>/*from  www  .j  ava2s. com*/

<button type="button" onclick="myFunction()">Test</button>

<script>
function myFunction() {
    document.getElementById("myList").style.listStyleImage = 'http://java2s.com/resources/a.png';
}
</script>

</body>
</html>

Related Tutorials