HTML and CSS Reference
In-Depth Information
This should look familiar, although I want to draw your attention to the lang
attribute on the <html> element. It is good practice to set an overall language for
the entire document like this for accessibility purposes: Screen readers will handle
various languages differently. For example, “six” is pronounced “six” in English
but “seees” in French.
Yo u c a n a l s of s e t t h e l a n g u a g e of f i n d i v i d u a l p a r t s of f t h e d of c u m e n t b y p u t t i n g
the lang attribute on any element that it makes sense to do so. For example:
<p>As the French say, <span lang=”fr”>c'est la vie</span>.</p>
Notice the two parts to the first language example you saw: en-gb . The first part
is called the primary language code, which unsurprisingly sets the overall language.
Yo u c a n fi n d a f u l l l i s t of f of v e r 8 0 0 0 of f t h e s e c of d e s a t t h e I A NA L a n g u a g e S u b t a g
Registry at The optional
second part sets a dialect of the primary language. So, for example:
en-gb is British English
en-us is American English
en-ca is Canadian English
Yo u c a n s e t y o u r o w n e x p e r i m e n t a l l a n g u a g e s u s i n g t h e x experimental primary
<html lang=”x-millsian-nonsense”></html>
Yo u s h o u l d a l s o s e t a c h a r a c t e r s e t f o r y o u r d o c u m e n t , w h i c h s p e c i fi e s t h e r a n g e
of text characters that can be used in your document: This has become much sim-
pler in HTML5. Previously, the line you needed to use looked something like this:
<meta http-equiv=”content-type” content=”text/html; charset=UTF-8” />
In HTML5 this line has been reduced to the following, which older browsers
will also understand: Add it just below the opening <head> tag:
<meta charset=”utf-8”>
Search WWH ::

Custom Search