使用 CSS 選擇屬性值以指定值結尾的元素


要選擇屬性值以指定值結尾的元素,請使用 [attribute$ = ”value”] 選擇器。

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

示例

線上演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         [alt$ = Connect] {
            border: 5px solid blue;
            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 年 6 月 24 日

238 次瀏覽

踢出您職業生涯

透過完成課程獲得認證

開始
廣告
© . All rights reserved.