/

HTML / CSS / JavaScript Tutorial

CSS Property: list-style-image

[this page | pdf | back links]

The CSS (CSS1) list-style-image property identifies an image that should be used as the list-item marker.

 

Valid property values (other than inherit and initial) are:

 

Value

Description

none

(default value). No image used. Instead, the type of list marker used is defined by the list-style-type property

url

URL path defining the image to be used as the list-item marker

 

Default Value:

none

JavaScript syntax:

e.g. object.style.listStyleImage="url(‘picture.gif’)"

Inherited:

Yes

Animatable:

No

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head>
<style>
div {width: 50px; border: 1px dotted black;}
.x1 {list-style-image: url(NematrianLogo.png);}
</style>
</head>
<body>
Element with default property<br>
<ul><li>x1</li><li>x2</li></ul>
Property set using in-file HTML style<br>
<ul class="x1"><li >x1</li><li>x2</li></ul>
Property set using JavaScript<br>
<ul id="x2"><li>x1</li><li>x2</li></ul>

<script>
document.getElementById("x2").style.listStyleImage = "url(NematrianLogo.png)";
</script>

</body>
</html>

FUNCTION THAT MAY ASSIST IN TESTING WHETHER FEATURE IS SUPPORTED:
function isSupportedCSSPropertyListStyleImage() {
  var x = document.createElement("DIV"); x.style.listStyleImage = "url(NematrianLogo.png)"; return (window.getComputedStyle(x, null).listStyleImage == "url(NematrianLogo.png)");
}


NAVIGATION LINKS
Contents | Prev | Next | CSS Properties


Desktop view | Switch to Mobile