Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to specify the use of text or titling figures in CSS?

Tags:

css

My fonts of choice usually default to text figures

Text figures

which is one reason I like them. However, for tables or headings I'd like to specify that lining figures should be used:

Titling figures

Is there a way to do so in CSS?

(To appease the search:

  • old-style numerals, text figures, non-lining figures, medieval numerals
  • lining numerals, titling figures)
like image 316
Joey Avatar asked May 30 '10 20:05

Joey


People also ask

Which property is used to control the look of the texts?

The text-transform property is used to control the case of letters in text.

What is CSS typography?

CSS Fonts is a module of CSS that defines font-related properties and how font resources are loaded. It lets you define the style of a font, such as its family, size and weight, line height, and the glyph variants to use when multiple are available for a single character.


1 Answers

Firefox 4.0 has basic text figure support. Here's how to turn on text (old-style) figures:

.text-figures {
  -moz-font-feature-settings: "onum=1";
}

Looks like there's a set of css3 properties, such as font-variant-numeric, to control common properties. These are not yet supported by any browser, as far as I know.

Here's a jsFiddle where you can play around with the styles. It toggles between lining and old-style figures. I'm using Minion Pro on Windows 7, so you might have to find your own supported font on other platforms.

like image 138
theazureshadow Avatar answered Oct 17 '22 04:10

theazureshadow