CSS3 and Telugu: Ordered lists with Telugu numerals and alphabet

It is a custom that ordered lists are presented with numerals or alphabet. And, Telugu web sites would want to present lists in their pages in Telugu numerals or alphabet. For example:

౧. శుక్రుడు
౨. బుధుడు
౩. భూమి
౪. అంగారకుడు

Or, with alphabet:

అ. శుక్రుడు
ఆ. బుధుడు
ఇ. భూమి
ఈ. అంగారకుడు

CSS3 makes these possible. CSS3 added a concept called counter styles and extended list-style-type property to accept any defined counter style as a value. CSS3 also added predefined counter style called telugu for Telugu numerals.

That means we can just write the following CSS for ordered lists to show up with Telugu numbers:

ol {
  list-style-type: telugu;
}

See this in action. At the time of writing this, it is working fine in Firefox and Chrome. Not in IE 11, though.

CSS3 did not define a counter style for lists with Telugu alphabet. But, the whole point of counter styles is to let web authors write their own counter styles. So, we can define our own list styles.

Let’s first define a counter style:

@counter-style telugu-alphabetic {
  system: alphabetic;
  symbols: 'అ' 'ఆ' 'ఇ' 'ఈ' 'ఉ' 'ఊ' 'ఎ' 'ఏ' 'ఐ' 'ఒ' 'ఓ' 'ఔ' 'అం' 'అః' 'క' 'ఖ' 'గ' 'ఘ' 'ఙ' 'చ' 'ఛ' 'జ' 'ఝ' 'ఞ' 'ట' 'ఠ' 'డ' 'ఢ' 'ణ' 'త' 'థ' 'ద' 'ధ' 'న' 'ప' 'ఫ' 'బ' 'భ' 'మ' 'య' 'ర' 'ల' 'వ' 'శ' 'ష' 'స' 'హ' 'ళ' 'క్ష' 'ఱ';
}

Now, we can use it as follows:

ol {
  list-style-type: telugu-alphabetic;
}

See this in action. This works in Firefox. Sadly, other browsers do not yet have support for user defined counter styles (@counter-style rules).

These counter styles can be extended to achieve different formatting needs like placing the number or letter in parentheses. Something like below:

(అ) శుక్రుడు
(ఆ) బుధుడు
(ఇ) భూమి
(ఈ) అంగారకుడు

I compiled few counter styles for Telugu covering major use cases, including styles with parenthesis. What else do you think should be covered?

One thought on “CSS3 and Telugu: Ordered lists with Telugu numerals and alphabet

Leave a Reply

Your email address will not be published. Required fields are marked *