簡體   English   中英

HTML CSS列表樣式更改

[英]HTML CSS listing style change

我想在代碼中使用清單以獲得以下輸出-

[1]. This is my line one
[2]. This is my line two
[3]. this is my line three, which is very very long and is not justified when used under list. 

我用下面的代碼。 但是沒有用

<ol list-style-type: [decimal];>
<li>This is my line one</li>
<li>This is my line two</li>
<li>this is my line three, which is very very long and is not justified when used under list.</li>
</ol>

我是html和CSS編碼的新手! 我現在面臨的問題是,當我使用這種風格時,長句子不能用單個數字來說明。 這是現在的樣子:image.ibb.co/e8Nfda/image.png如何調整線條?

根據您的要求進行了更新:

 ol { list-style: none; counter-reset:array;} ol li{text-indent: -2em;} ol li:before { counter-increment:array; content:"[" counter(array) "]. "; } 
  <ol> <li>This is my line one This is my line one This is my line one This is my line one This is my line one This is my line one</li> <li>This is my line two</li> <li>this is my line three</li> </ol> 

試試這個CSS jsfiddle

ol { list-style: none; 
counter-reset:array;}
ol li:before {
counter-increment:array;
content:"[" counter(array) "] ";
}

暫無
暫無

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

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