Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

CSS property `list-style-position`

`list-style-position` places the marker outside or inside the list item principal box.

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

Syntax

inside | outside

list-style-position places the marker outside or inside the list item principal box.

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

The accepted grammar is inside | outside; global values still participate in the cascade.

With inside the marker participates in the first line box; outside creates a separate marker box, so wrapped text aligns differently.

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-position";const candidates=["inside"];
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=inside; type=disc; position=inside; image=none; marker=inline

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

Sources