CSS Property: list-style
[this page | pdf | back links]
The CSS (CSS1) list-style property is a shorthand
property combining up to 3 list properties.
Valid property values
(other than inherit
and initial) are
defined by the elements of the shorthand. Shorthand elements (in the order in
which they appear) are:
-
list-style-type
-
list-style-position
-
list-style-image
Default Value:
|
disc outside none
|
JavaScript syntax:
|
e.g. object.style.listStyle="decimal inside"
|
Inherited:
|
Yes
|
Animatable:
|
See individual
properties
|
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: decimal inside;}
</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.listStyle = "decimal inside";
</script>
</body>
</html>
|
FUNCTION THAT MAY ASSIST IN TESTING WHETHER FEATURE IS SUPPORTED:
function isSupportedCSSPropertyListStyle() {
var x = document.createElement("DIV"); x.style.listStyle = "decimal inside"; return (window.getComputedStyle(x, null).listStyle == "decimal inside");
} |
NAVIGATION LINKS
Contents | Prev | Next | CSS Properties