导航
×
   ❮   
HTML CSS JavaScript PHP Go Sass W3C Colors ECMS

CSS :lang() 伪类


实例

将 lang 属性值为 "it"(意大利语)的任何<p> 元素设为样式

p:lang(it) {
  background-color: yellow;
  font-style: italic;
}
亲自试一试 »

定义和用法

The :lang() pseudo-class is used to select elements with a lang attribute with the specified value.

注意: lang 属性值通常是两个字母的语言代码,如 lang="fr"(法语),或者两个语言代码的组合,如 lang="fr-ca"(加拿大法语)。

版本 CSS2

浏览器支持

表中数字表示该伪类完全支持的第一个浏览器版本。

伪类
:lang() 4.0 8.0 2.0 3.1 9.6

CSS 语法

:lang(languagecode) {
  CSS 声明;

Copyright ©2020-2026 freew3c.com All Rights Reserved 提供的内容仅用于学习和测试,不保证内容的正确性。