簡體   English   中英

CSS ul li格式

[英]CSS ul li formatting

我一直在嘗試找出如何在帶編號的列表和文本之間放置空格,並且仍然使文本很好地環繞在其上方的行下。 我在Stack Overflow上找到了一些可以正常工作的腳本,但由於某種原因,我只能得到項目符號,而不能得到數字。

謝謝。

 ul { margin: 0; padding: 50; } /* The wider the #list_wrapper is, the more columns will fit in it */ #list_wrapper { width: 1000px } /* The wider this li is, the fewer columns there will be */ ul.multiple_columns li { text-align: right; float: right; list-style: decimal; height: 30px; width: 400px; } 
 <form id="form1" runat="server"> <div> <div id="list_wrapper"> <ul class="column-count: 2;"> <li>One: If I knew how to spell the ABC's I would write and write and write and write and write and write and write some more and write and write and write and write and write and write and write.</li> <li>Two</li> <li>Three</li> <li>Four</li> <li>Five</li> <li>Six</li> <li>Seven</li> <li>Eight</li> <li>Nine</li> </ul> </div> </div> </form> 

ul (無序列表)更改為ol (有序列表)。

CSS變為:

ol{
margi... }

ol.multiple_columns li{
    text-align: right;
    float: ri... }

HTML變成:

<ol class="column-count: 2;">
<li>One: If I knew ...</li>
<li>Two</li>
...
</ol>

為了使列表編號為粗體而不是文本,您可以在CSS中將ol類更改為包括font-weight:900;

ol {
  margin: 0;
  padding: 50;
  font-weight: 900;
}

然后包裝<li>的文本以包含<span style="font-weight:normal;"></span> ,如下所示:

<li><span style="font-weight:normal;">One: If I knew how to spell  ... </span></li>

如果不使跨度將文本恢復為正常的粗細,則數字和文本都將為粗體。 順便說一句, font-weight范圍為100-900。 900是最重的重量。

暫無
暫無

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

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