WissensdatenbankPrüfungszentrum
DEDeutsch
Sprache wählen13

CKTIS / CSS

CSS-Eigenschaft `list-style-type`

`list-style-type` wählt Glyphe, Zeichenfolge oder Zählerstil des Listenmarkers.

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

Syntax

<counter-style> | <string> | none

list-style-type wählt Glyphe, Zeichenfolge oder Zählerstil des Listenmarkers.

Das Beispiel setzt square an einem echten li und meldet listStyleType sowie ::marker.

Die akzeptierte Grammatik ist <counter-style> | <string> | none; globale Werte nehmen weiterhin an der Kaskade teil.

Ein gültiges list-style-image hat Vorrang; none entfernt das Symbol, nicht die Listensemantik.

Beispiele

<!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>

Ergebnis

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

Das Beispiel lief lokal in einer isolierten Chrome-Sitzung ohne Netzwerk; das Ergebnis stammt aus der CSS-API des Browsers.

Quellen