使用 CSS 根據指定的值開頭來選擇有指定屬性的元素
使用 [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>
廣告
資料結構
網路
關係型資料庫管理系統
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP