How to create a 1.1, 1.2 1.3 … HTML list?

前端 未结 6 1615
不思量自难忘°
不思量自难忘° 2021-02-19 23:52

I want to create HTML nested lists that has the following format:

1  
   1.1  
   1.2  
   1.3  
   1.4   
2
   2.1

I tried a solution that I f

6条回答
  •  心在旅途
    2021-02-20 00:03

    This example uses IE6-specific CSS attribute behavior to add a static marker before each li. There must be some MS specific magic that can replace a static dash with a counter.

    If you want it to be a CSS solution, use this as a starting point and then google "MSDN".

    ul.example { margin: 0.5em 0; padding: 0 0 0 2em; }
    ul.example li
    {
        margin: 0.5em 0; padding: 0 0 0 20px;
        list-style-type: none;
        behavior: expression( !this.before
            ? this.before = this.innerHTML = '— ' + this.innerHTML : '' );
        text-indent: -1.24em;
    }
    ul.example li:before { content: '\2014\a0'; }
    

提交回复
热议问题