htmllistthai

How to set ordering list with Thai character list item type?


I want to show below list itmes with thai character ordering -

ก. Lorem Ipsum dolor
ข. Lorem Ipsum dolor
ค. Lorem Ipsum dolor

I have tried with list-style-type:thai; but this is showing thai numbers in list.

<ol style="list-style-type:thai;">
  <li>Lorem ipsum dolor</li>
  <li>Lorem ipsum dolor</li>
  <li>Lorem ipsum dolor</li>
</ol>

Output:
enter image description here

How can I generate this?


Solution

  • W3C has a proposal on defining an additional value to list-style-type, thai-alphabetic. Unfortunately, it is not yet supported by popular browsers.

    Nothing, however, prevents you from defining it in your documents:

    CSS:

    @counter-style thai-alphabetic {
      system: alphabetic;
      symbols: "\E01" "\E02" "\E03" "\E04" "\E05" "\E06" "\E07" "\E08" "\E09" "\E0A";
      suffix: " ";
    }
    
    .items {
      list-style: thai-alphabetic;
    }
    

    Mind the system attribute as it defines how numeric value is converted to your representation. In particular, example given above would render list item #11 as กก. while you may need the continuation throughout all available Thai consonants.

    HTML:

    <ol class="items">
      <li>test1</li>
      <li>test2</li>
    </ol>