簡體   English   中英

排序列表編號和內容的不同樣式

[英]Different style for ordered list number and content

是否有可能使有序列表的數字(或字母或數字等)與內容具有不同的樣式,而在每個列表元素內部沒有某種div或span標簽?

可以將列表樣式設置為“ none”,並用CSS計數器和偽元素替換默認編號。 示例: http//jsbin.com/agagoc/1/edit

ol {
  list-style: none;
  counter-reset: my-awesome-counter;
}

li {
  counter-increment: my-awesome-counter;
}

li:before {
  content: counter(my-awesome-counter);
  /* any style for numbers, as if they were spans before the content of LIs, goes here */
}

是的,您可以這樣:

li {
  list-style: none;
  counter-increment: myCounter;
}
li:before {
    content: counter(myCounter);
    font-size: 19px;
    color: red;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM