East Asia Student

Random Stuff Related to East Asia

Japanese

Chinese and Japanese list numbering in CSS

I just found out that you can set up numbered HTML lists to display numbers in hanzi, hiragana or katakana. Take a look:

- This is the first item, - this is the second, - this is the third, - and this is the fourth - This is the first item, - this is the second, - this is the third, - and this is the fourth - This is the first item, - this is the second, - this is the third, - and this is the fourth

It’s all done with the CSS list-style-type property, which can be given the following values for Chinese and Japanese numbering:

  • cjk-ideographic
  • hiragana
  • hiragana-iroha
  • katakana
  • katakana-iroha

So the code for one of the above lists is simply:

  • This is the first item,
  • this is the second,
  • this is the third,
  • and this is the fourth

The browser then generates the correct sequence of Chinese numbers. You can play with this feature here. I’m quite impressed that the CSS specification covers Chinese and Japanese, as usually CJK languages don’t get very good support on the Web. It’s a shame there’s no option for Korean numbering, though, although I guess cjk-ideographic would be fine for Korean speakers (or Arabic numerals, of course).

I had spotted this used on Sinoglot, now that I come to think of it, but I didn’t realise at the time how simple it is to implement with CSS. The usage cases for it have got to be pretty rare, though, it has to be said. Native speakers of Chinese, Japanese or Korean use Arabic numerals just like the rest of the world, so it’s unlikely someone would want lists numbered with hanzi or kana. Still, nice to know it’s there as an option.

However, I am going to have the obligatory whinge here about the name “cjk-ideographic”. There’s an ongoing debate about how to classify hanzi as a writing system, with most people arguing that they’re logograms. So if we’re being anal about it, the label should be “cjk-logographic”. But we don’t want to be silly, so I think “hanzi” is the obvious term in English. We don’t need something as fluffy as “Chinese ideographs”, “Chinese logograms” or even “Chinese characters”. The obvious choice is to just call them hanzi (or kanji if you’re that way inclined). That’s another post in itself though.

Tags