Browsing posts in: Uncategorized

An introduction to CSS @counter-style

The characters that indicate items in a list are called counters — they can be bullets or numbers. They are defined using the list-style-type CSS property. CSS1 introduced a list of predefined styles to be used as counter markers. The initial list was then slightly extended with addition of more predefined counter styles in CSS2.1. Even with 14 predefined counter styles, it still failed to address use cases from around the world.

Now, the CSS Counter Styles Level 3 specification, which reached Candidate Recommendation last week, adds new predefined counter styles to the existing list that should address most common counter use cases.

In addition to the new predefined styles, the spec also offers an open-ended solution for the needs of worldwide typography by introducing the @counter-style at-rule — which lets us define custom counter styles or even extend existing ones — and the symbols() function. The latter is a shorthand for defining inline styles and is useful when the fine-grained control that @counter-style offers is not needed.

This is the excerpt from an article I wrote in the hacks.mozilla.org blog when @counter-style was shipped in Firefox. The article provides a guide to using the new counter features of CSS Level 3. Please read the full article here. See a demo of various @counter-style usages here (works only in Firefox).


Cultural Learnings of China for Make Benefit Glorious People Everywhere

Excuse the title 😛 I just wanted to share a few things that might be helpful to know if you are visiting China for the first time.

  1. Food! – Food in China is definitely not the ‘Chinese’ you eat in your country. I found real Chinese food much more tastier (and healthier, coz they eat it every day). Also the variety in food is overwhelming. Do try everything you can get your hands on.
  2. No tipping in restaurants.
  3. China is not cheap. I, like many others, assumed that since most of the goods we use are made in China, I could get stuff for cheap from there. But this proved a myth. My Nike shoes (made in China) costs the same, if not more, in China, as it is at home. This is especially true if you are visiting only the big cities. The places that manufacture these goods are in the more remote places.
  4. Haggle – don’t be ashamed to haggle when you go around buying from local vendors. You can often negotiate and bring the price down much lower than what was offered first.
  5. Get a guide who speaks Chinese. Unless you or someone traveling with you know Chinese, make sure you get a guide who can speak Chinese. English is of no help in China, especially if you are traveling outside of big cities like Beijing. But even in Beijing, the vast majority (save for kids) don’t speak English. Anyway, it wouldn’t hurt learning a few useful Chinese words and sentences before your trip.
  6. Be wary of counterfeit currency when you spend money and get change from someone. I don’t know how to detect counterfeit Chinese currency, so better check about it somewhere before you go.
  7. Chopsticks – People eat with chopsticks, not spoon or fork and knife. You could find it a little difficult to eat with a chopstick at first, but stick with it (pun intended) and you will get considerably better in a couple of days. And using chopsticks, instead of spoons like some lame foreigners, will earn you respect from the Chinese. (Now don’t go embarrassing yourself trying to drink soup with chopsticks; that’s what they give you the spoons for).
  8. Continue Reading


New Year Resolutions

New year is here and crazy people all over the world are busy making new year resolutions that they know they will stop following just a few days into the new year. Yet here is another stupid guy’s new year resolutions – as a humble tribute to all those out there crazy enough to take unrealistic decisions and follow their crazy minds.

Below are my “resolutions” for the year ahead.

1. Do at least one good thing a day.

2. Publish a blog post at least once every two weeks.

3. (and here is the usual -> ) Of course, start working out 😀

4. Do more stuff outside of the computer. Carpe diem.

Update (Feb 2013): Yeah, yeah, yeah.. Nothing worked (as usual) :p