CSS [attribute] 選擇器的使用
使用 [attribute] 選擇器來選擇具有屬性的元素,例如 alt 屬性或 target 屬性等。
您可以嘗試執行以下程式碼來實現 CSS[attribute] 選擇器:
示例
<!DOCTYPE html>
<html>
<head>
<style>
img[alt] {
border: 3px solid orange;
}
</style>
</head>
<body>
<img src = "https://tutorialspoint.tw/videotutorials/images/tutor_connect_home.jpg"
height="200" width="200">
<img src = "https://tutorialspoint.tw/videotutorials/images/tutorial_library_home.jpg"
height = "200" width="200" alt = "Tutorials Library">
</body>
</html>
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
安卓
Python
C 語言
C++
C#
MongoDB
MySQL
Javascript
PHP