使用 CSS 選擇其 href 屬性值包含子字串“java”的每個 <a> 元素
使用 [attribute*=”value”] 選擇器選擇其屬性值包含指定值元素。
您可以嘗試執行以下程式碼來實現 CSS [attribute*="value"] 選擇器,
示例
<!DOCTYPE html> <html> <head> <style> [href* = java] { border: 5px solid orange; border-radius: 5px; } </style> </head> <body> <a href = "https://tutorialspoint.tw/php/index.htm">PHP Tutorial</a> <a href = "https://tutorialspoint.tw/java/index.htm">Java Tutorial</a> </body> </html>
廣告