简体   繁体   English

HTML CSS列表样式更改

[英]HTML CSS listing style change

I want to use listing in my code to get the following output - 我想在代码中使用清单以获得以下输出-

[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. 

I used the following code. 我用下面的代码。 but did not work 但是没有用

<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>

I am new to html and css coding.! 我是html和CSS编码的新手! The problem now i face is when i use this style long sentences are not justified under a single number. 我现在面临的问题是,当我使用这种风格时,长句子不能用单个数字来说明。 Here is how it looks like now : image.ibb.co/e8Nfda/image.png how to justify my lines? 这是现在的样子:image.ibb.co/e8Nfda/image.png如何调整线条?

Updated with your requirement : 根据您的要求进行了更新:

 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> 

Try this css jsfiddle 试试这个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