使用 CSS 選擇 alt 屬性值以“Tutor”開頭的每一個 元素


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

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

示例

線上演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         [alt|=Tutor] {
            border: 5px solid orange;
            border-radius: 5px;
         }
      </style>
   </head>
   <body>
      <img src = "https://tutorialspoint.tw/videotutorials/images/tutor_connect_home.jpg" height="200" width="200" alt="Tutor-Connect">
      <img src = "https://tutorialspoint.tw/videotutorials/images/tutorial_library_home.jpg" height="200" width="200" alt="Tutorials-Library">
   </body>
</html>

更新於: 2020-06-24

112 檢視

開啟你的 職業生涯

完成課程即可獲得認證

開始
廣告