开发者

Where to specifiy the language of Document in HTML 5 when my page has two languages?

This is HTML5 Skeleton

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Bare Bones HTML5</title>
</head>
开发者_Python百科<body>
</body>
</html>

If my webpage has some part in Danish and some in English then How I should define the language of the page in HTML?


You can only define one language as the HTML's primary language. There can be only one language (no multiple values) specified for the <html> tag's lang attribute. But you can define a different language for some parts of the page.

For example:

<html lang="en">
...
<p lang="de">Ja, Deutsch.</p>

See the HTML5 spec for further info.


You can define the language in html tag itself. if you do following :

<!DOCTYPE html>
<html lang = "en">
<head>
    <title> ... </title>
</head>
<body>
...
</body>
</html>

in the above markup code you defined "en" or english as your default language for whole document.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜