语言伪类选择器
为整个文档设定语言,有两种方法
第一种
<!DOCTYPE HTML>
<html lang=“en-us”>
第二种方法<body lang="fr">
为局部部分设置语言
:语言伪类选择器允许为不同的元素设置不同的语言
定义某元素语言<p lang="fr">
E:lang(){ }
为该元素设置属性
p:lang(fr){
quotes: '"' '"';
font-family: Arial;
background: red
}
<!DOCTYPE html>
<html>
<head>
<meta charset="fr">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>语言伪类选择器</title>
<style>
:lang(en){
quotes: '"' '"';
font-family: Arial;
background: red
}
:lang(fr){
quotes:'|' '|';
background:green;
}
</style>
</head>
<body>
<p lang="fr">WWF's goal is to:
<q cite="http://www.wwf.org">
build a future where people live
</q> we hope they succeed.</p>
<div class="lang">你好</div>
<p lang="en">WWF's goal is to:
<q cite="http://www.wwf.org">
build a future where people live
</q> we hope they succeed.</p>
</body>
</html>

浙公网安备 33010602011771号