CKTIS / CSS
CSS свойство `list-style-type`
`list-style-type` избира глифа, низа или стила на брояча за маркера.
Версия: CSS modules; captured CSSWG editor index includes draft and obsolete features requiring review
Синтаксис
<counter-style> | <string> | nonelist-style-type избира глифа, низа или стила на брояча за маркера.
Примерът задава square на реален li и отчита listStyleType и ::marker.
Приетата граматика е <counter-style> | <string> | none; глобалните стойности остават част от каскадата.
Валиден list-style-image има предимство; none премахва символа, не семантиката на списъка.
Примери
<!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>Резултат
value=square; type=square; position=outside; image=none; marker=inline-block
Примерът е изпълнен локално в изолирана Chrome сесия без мрежа; резултатът идва от CSS API на браузъра.