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.com/videotutorials/images/tutor_connect_home.jpg"
height="200" width="200">
<img src = "https://tutorialspoint.com/videotutorials/images/tutorial_library_home.jpg"
height = "200" width="200" alt = "Tutorials Library">
</body>
</html>
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP