Danh mục

Sams Teach Yourself CSS in 24 Hours- P9

Số trang: 50      Loại file: pdf      Dung lượng: 2.00 MB      Lượt xem: 10      Lượt tải: 0    
tailieu_vip

Xem trước 5 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Sams Teach Yourself CSS in 24 Hours- P9: Times have changed, thankfully, since those Dark Ages of CSS. All major browsers aswell as some minor ones have increased support for Cascading Style Sheets in the latestversions. Web developers are aware of CSS and the vital role they play in designing greatWeb pages, and presumably you’ve got some idea of how important they are if you’vebought this book.
Nội dung trích xuất từ tài liệu:
Sams Teach Yourself CSS in 24 Hours- P9382 Hour 21 Internationalization Internationalization—sometimes abbreviated as i18n—“the letter i, 18 other letters, and the letter n” —is the practice of making content available in a variety of languages, not simply one. With a truly worldwide World Wide Web, the standards that are used on the Web simply can’t support only the English language. The Cascading Style Sheets lan- guage has been partially internationalized, which means it can be used, with varying degrees of success, with many languages and local variants. On the Web, languages are indicated by a two-letter code, sometimes followed by a dash and an additional country code for regional versions of a language. Some of these lan- guages are shown in Table 21.6; for a complete list, see http://www.cssin24hours.com/ 21/lang.html. TABLE 21.6 Several Language Codes Code Language de German en English en-ca Canadian English en-uk British English en-us American English fr French jp Japanese ru Russian The choice of language can dictate a number of factors, including the direction of the text, the fonts used, or even the dictionary for pronunciation used by a screenreader. The CSS language doesn’t allow you to set the language, which must be done in the HTML or in an HTTP header, but it does let you create rules or style sheets that apply only to certain languages. To set the language within an HTML document, you simply have to use the lang attribute on the tag. Sections of a second language embedded within the docu- ment can be indicated with the lang attribute on a or any other appropriate HTML element, such as or . Accessibility and Internationalization 383 The :lang() Pseudo-class The CSS Level 2 specification defines a special pseudoclass, :lang(), for indicating rules that should be applied only to elements that match a certain language. Such a rule is written like the following: :lang(en-uk) { background-color: #CCCCFF; } This would display anything written in British English with a light blue background color. How does the browser know which parts of the text are written in British English? It needs to be set in the HTML, like the following: He cried out in a bad Monty Python imitation, He’s pinin’ for the fjords! By itself, :lang() is not particularly useful, but when combined with other CSS rules and properties, it can be quite powerful. Some of those that involve generated content will be discussed in the next hour. List Markers One way in which :lang() rules can be used is to set an appropriate marker for ordered lists. You’ll recall that you can set the list marker to count using Roman numerals, num- bers, or letters, but what about languages that don’t use the same alphabet? A list of addi- tional values for the list-style-type property is shown in Table 21.7.TABLE 21.7 International Values for the list-style-type Property Value Effect armenian Traditional Armenian numbers cjk-ideographic Ideographic numbers (Asian languages) georgian Traditional Georgian numbers hebrew Traditional Hebrew numbers hiragana Japanese hiragana numbers hiragana-iroha Japanese hiragana-iroha numbers katakana Japanese katakana numbers katakana-iroha Japanese katakana-iroha numbers lower-greek Lowercase Greek letters 21384 Hour 21 You don’t have to use a :lang() selector to utilize these values; you could use a normal element selector, a class or id selector, or anything else that fits your markup. Here are two examples: li:lang(jp) { list-style-type: hiragana; } ul.alphabeta { list-style-type: lower-greek; } These are supported only for those browsers and operating systems that support these character sets and appropriate fonts. This is highly dependent upon the specific version and language support on ...

Tài liệu được xem nhiều: