[英]How can I have numbers with a custom format in an ordered list in HTML?
[英]Is it possible to format an ordered list with hexadecimal numbers?
我不希望我的<ol>
項呈現為1, 2, 3 ... 9, 10
,我希望它們編號為0x01, 0x02 ... 0x09, 0x0a
。 這有可能嗎?
進一步改進了Makotosan的解決方案: http : //jsfiddle.net/Merrinen/nZxFJ/1/
你可以用一點JavaScript來做到這一點。 這是一個使用jQuery幫助的片段。
$('li').each(function(index){
$(this).text('0x' + (index + 1).toString(16) + ' ' + $(this).text());
});
以下是它的工作示例: http : //jsfiddle.net/QkNb4/
我不這么認為。 從這篇CSS-Tricks文章中 ,我們將來可以做到這一點:
/*
Examples from THE FUTURE
No browser support at the time of this writing
*/
li::marker {
width: 30px;
text-align: right;
margin-right: 10px;
display: inline-block;
}
ol {
list-style: symbols("*" "\2020" "\2021" "\A7");
}
ul {
list-style-type: "★";
}
目前,我認為我們僅限於list-style-type
可用的內容,但我可能錯了。 你可以使用:before
偽類,並使用里面的content
屬性,但它不是最優雅,或易於維護。
你可以做到這一點,但我會擔心在大型列表中使用它和/或當代碼中有很多不同的手指時。 如果你密切關注它,它是可維護的。 檢查一下: http : //jsfiddle.net/jalbertbowdenii/zhuum/10/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.