我想在我的代码中使用 list 来获得以下输出 -
[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>
关于HTML CSS 列表样式更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46014705/