This page has been substatively changed since the start of the review period.
In Chinese, Japanese, Korean, and Mongolian vertically-set text it is normal for list counters to sit upright above the start of the list.
Until recently this was problematic, because browsers would only show the numbers lying on their side. This article describes how to make them stand upright as shown in the picture above, and the currently remaining issues.
We'll look at three alternative approaches, one of which works across all major browser engines, another which doesn't currently work with WebKit browsers, and a third that doesn't yet work with any major browser.
The simplest approach is to use counters that are always upright in vertical text.
Customised counter-styles are now supported by all major browser engines. This therefore provides an opportunity that will lead to an interoperable solution.
First, you need to create an @counter-style
declaration in your CSS. We suggest a circled decimal style below, but as these are customisable you can also make up your own.
This counter style definition is taken from Ready-made Counter Styles, where you can find several alternative styles that may be of interest. The suffix is still specified, to avoid the default full stop appearing, but is reduced to a null string to avoid harmful effects on the horizontal positioning.
Note that this particular counter style is of the “fixed” type. This means that it only supports lists containing up to 50 items. Other similar styles may support fewer counters. This is probably not problematic for most lists in vertical text.
Once you have added this counter-style definition to your CSS, then tie it to your list using CSS code such as the following. You can, of course, add a class name or context to your element selector, if you want to apply the style to just certain lists.
Output in your browser:
Many horizontal counter styles use simple digits or alphabetic characters as counters, but in vertical text this will result in a counter lying on its side. Here we look at how to prevent that, using ordinary decimal counters. This would enable you to have lists longer than those described above, but it's necessary to take one or two extra steps to ensure that the counter is upright and is properly centred above the vertical line.
For this approach we use the following CSS.
We use a counter-style rule to remove the dot and space that follow decimal counters by default. (To make the counter look like "1.", "2,", etc. just set the suffix to "."
.) We then use CSS's ::marker
pseudo-element to make the counter stand upright above the line.
Here's the result in your browser. It works in Blink and Gecko browsers, but it doesn't work at all in WebKit browsers, so it's not a fully interoperable solution (at least not yet).
Output in your browser:
The example above shows the basic mechanics, but it could do with some additional styling to look right.
Both types of list described above can benefit from additional styling. For example, using the following CSS we can make the markers in the example just above slightly bigger, and coloured, and we can create an appropriately sized gap between the counter and the list text. (Some of these things are slightly unusual, but they serve as a demonstration of what's possible.)
We'll also change the counter to have parentheses around it. Note how the browser squeezes the result to fit within a line.
Output in your browser:
The CSS ::marker
pseudo-element allows you to apply the following adjustments:
white-space
propertycolor
text-combine-upright
, unicode-bidi
, and direction
content
propertyAnother common style of counters looks like the following.
The basic principle for creating this style is the same as previously described, but with a twist, because we need to allow the parentheses to rotate but keep the digit(s) upright.
In theory, we just need to use a different value for text-combine-upright
.
The digits
value seeks out digits within a string and makes them horizontal while leaving the surrounding text vertical. (The syntax shown should work for any 2-digit number. If you ever need to go higher than that, just use digits 4
to allow for numbers up to 9,999.)
Unfortunately, this is only a theoretical solution for the time being, because no browser yet supports the digits
value.
Authoring web pages
Language Enablement
Gap Analysis tracker