Define multiple languages in html root element's lang attribute?

前端 未结 5 1127
执念已碎
执念已碎 2021-02-01 03:52

I want to determine more than one language for a document, because it\'s available in more than one language. If I use:



        
5条回答
  •  南旧
    南旧 (楼主)
    2021-02-01 04:38

    You can't use it like this.

    You'll have to either use an encoding that encompasses all desired chars (e.g UTF-8) which supports the entire Unicode range), or else use named entities or numeric references to include characters outside the encoding in use.

    http://bytes.com/topic/html-css/answers/154652-multiple-languages-one-document

    UPDATE

    If using HTML5 then you can use lang for each element. That means if you have a div that contains Mandarin Chinese in it, just define an attribute lang="zh-CN" for that div, like . ( What is the HTML5 alternative to the obsolete meta http-equiv=content-language. )

提交回复
热议问题