使用 CSS 選中所有 `lang` 屬性值以“en”開頭的元素


使用 [attribute|=”value”] 選擇器選中指定屬性以指定值開頭的元素。

你可以嘗試執行以下程式碼來實現 CSS [attribute|=”value”] 選擇器,

示例

即時演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         [lang| = en] {
            border: 5px solid orange;
            border-radius: 5px;
         }
      </style>
   </head>
   <body>
      <p lang = "en">Hello</p>
      <p lang = "no">Hei</p>
   </body>
</html>

更新於:2020 年 6 月 23 日

165 次瀏覽

開啟您的 職業生涯

完成課程即可獲得認證

開始
廣告