:lang
/* 选取任意的英文(en) 段落 */
p:lang(en) {
quotes: '\201C' '\201D' '\2018' '\2019';
}
语法
正式语法
:lang( <language-code> )
参数
Example
HTML
<div lang="en"><q>This English quote has a <q>nested</q> quote inside.</q></div>
<div lang="fr"><q>This French quote has a <q>nested</q> quote inside.</q></div>
<div lang="de"><q>This German quote has a <q>nested</q> quote inside.</q></div>
CSS
:lang(en) > q { quotes: '\201C' '\201D' '\2018' '\2019'; }
:lang(fr) > q { quotes: '« ' ' »'; }
:lang(de) > q { quotes: '»' '«' '\2039' '\203A'; }
Result
规范
Specification |
---|
Selectors Level 4 # lang-pseudo |
浏览器兼容性
BCD tables only load in the browser
参见
- 语言相关伪类:
:lang
,:dir
- HTML
lang
属性 - BCP 47 - Tags for Identifying Languages