CSS:lang 选择器的作用


使用 CSS :lang 选择器为带有 lang 属性值的每个 <p> 元素设置 CSS 样式。可以尝试运行以下代码来实现 :lang 选择器

示例

实时演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         p:lang(fr) {
            background: greeb;
         }
      </style>
   </head>
   <body>
      <p>This is my country</p>
      <p lang = "fr">C'est mon pays</p>
      <p>French is the language of France</p>
   </body>
</html>

更新于:30-6 月-2020

78 次浏览

开启你的 职业生涯

通过完成课程获得认证

立即开始
广告
© . All rights reserved.