Page 57 - HTML5
P. 57

Chapter 8: Content Languages




        Syntax



            •  <element lang="language_code">   <!-- Language code has to be in the format [ISO 639-1](
              https://en.wikipedia.org/wiki/ISO_639-1 ) -->


        Remarks



        The value of the lang attribute must be a valid BCP 47 language tag or the empty string (if the
        language is unknown).

        The BCP 47 language tags are listed in the IANA Language Subtag Registry.


        Accessibility


        The relevant WCAG 2.0 Success Criteria are:


            •  3.1.1 Language of Page
            •  3.1.2 Language of Parts

        The related WCAG 2.0 Techniques are:

            •  H57: Using language attributes on the html element
            •  H58: Using language attributes to identify changes in the human language


        Examples



        Element Language


        The lang attribute is used to specify the language of element content and attribute text values:


         <p lang="en">The content of this element is in English.</p>



         <p lang="en" title="The value of this attribute is also in English.">The content of this
         element is in English.</p>


        The language declaration gets inherited:


         <div lang="en">
           <p>This element contains English content.</p>
           <p title="This attribute, too.">Same with this element.</p>
         </div>


        Elements with Multiple Languages




        https://riptutorial.com/                                                                               41
   52   53   54   55   56   57   58   59   60   61   62