Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

CSS property `list-style-type`

`list-style-type` selects the glyph, string, or counter style used for the list marker.

Version: CSS modules; captured CSSWG editor index includes draft and obsolete features requiring review

Syntax

<counter-style> | <string> | none

list-style-type selects the glyph, string, or counter style used for the list marker.

The example sets square on a real li and reports listStyleType together with the ::marker style.

The accepted grammar is <counter-style> | <string> | none; global values still participate in the cascade.

A valid list-style-image takes precedence over the type; none removes the symbol but not the element’s list semantics.

Examples

<!doctype html>
<html lang="en"><meta charset="utf-8"><title>CKTIS CSS reference example</title>
<body><div class="probe">probe</div><pre id="result"></pre><script>
document.body.innerHTML = '<ul><li id="item">entry</li></ul><pre id="result"></pre>';
const item=document.querySelector("#item");const property="list-style-type";const candidates=["square"];
const value=candidates.find(candidate=>CSS.supports(property,candidate));item.style.setProperty(property,value);
const style=getComputedStyle(item);const marker=getComputedStyle(item,"::marker");
document.querySelector("#result").textContent="value="+value+"; type="+style.listStyleType+"; position="+style.listStylePosition+"; image="+style.listStyleImage+"; marker="+marker.display;
</script></body></html>

Result

value=square; type=square; position=outside; image=none; marker=inline-block

The example was executed locally in an isolated, network-free Chrome session; the result comes from the browser CSS API.

Sources