html lang属性的疑惑

学习xhtml过程中,发现很多标签都可用lang属性,但是lang属性的用途是什么呢?

在《HTML XHTML CSS BIBLE 5th edition》一书中是这样讲解的:
[b]Most tags support the lang attribute, which defines the language in which the content of the
tag should be displayed. For example, specifying en corresponds to English; en-US specifies the
United States version of English (as opposed to UK). This attribute has the same format as the
rest of the attributes: lang="en-US".[/b]

书中说是定义了标签内容使用的语言。但是在具体的应用中也没发现有什么用途一样?
------------test.html-----------------
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>Test tag lang attribute</title>
</head>
<body>
<p lang="zh-CN">你好</p>
<p lang="en-US">hello</p>
<p lang="ja-JP">こんにちは</p>
<p lang="ko-KR">안녕하세요</p>

</body>
</html>

------------test1.html----------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>Test tag lang attribute</title>
</head>
<body>
<p>你好</p>
<p>hello</p>
<p>こんにちは</p>
<p lang="ko-KR">안녕하세요</p>

</body>
</html>

test.html使用了lang属性来标示标签内容的语言。
test1.html没有使用lang属性来标示标签内用的语言。
注:为了防止UTF-8能显示所有语言的内容,故<meta>标签中设置为GBK。

但是结果发现,两个网页效果一样,都能正常显示。
是不是说明,这个lang属性没用呢?还是有什么其他可以使用的地方?
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值