[color]:选择具有 color 属性的元素
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box {
width: 100px;
height: 100px;
}
[color] {
background-color: green;
}
</style>
</head>
<body>
<div class="box" color></div>
</body>
</html>

[color="red"] 选择具有 color 属性且属性值等于 red 的元素
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box {
width: 100px;
height: 100px;
}
[color="red"] {
background-color: red;
}
</style>
</head>
<body>
<div class="box" color="red"></div>
</body>
</html>

[color~="orange"] 选择 color 属性包含 orange 单词的元素
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box {
width: 100px;
height: 100px;
}
[color~="orange"] {
background-color: orange;
}
</style>
</head>
<body>
<div class="box" color="orange pink "></div>
</body>
</html>

[color|="yellow"] 选择 color 属性以 yellow 或 yellow- 开头的元素
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box {
width: 100px;
height: 100px;
}
[color|="yellow"] {
background-color: yellow;
}
</style>
</head>
<body>
<div class="box" color="yellow-pink "></div>
</body>
</html>

[color^="skyblue"] 选择 color 属性以 skyblue 开头的元素
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box {
width: 100px;
height: 100px;
margin-bottom: 5px;
}
[color^="skyblue"] {
background-color: skyblue;
}
</style>
</head>
<body>
<div class="box" color="skyblue"></div>
<div class="box" color="skybluehaha"></div>
<div class="box" color="skyblue-haha"></div>
</body>
</html>

[color$="blue"] 选择 color 属性以 blue 结尾的元素
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box {
width: 100px;
height: 100px;
margin-bottom: 5px;
}
[color$="blue"] {
background-color: blue;
}
</style>
</head>
<body>
<div class="box" color="blue"></div>
<div class="box" color="deepblue"></div>
<div class="box" color="very blue"></div>
</body>
</html>

[color*="purple"] 选择 color 属性包含 purple 的元素
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box {
width: 100px;
height: 100px;
margin-bottom: 5px;
}
[color*="purple"] {
background-color: purple;
}
</style>
</head>
<body>
<div class="box" color="purple haha"></div>
<div class="box" color="purplehaha"></div>
<div class="box" color="very purple"></div>
</body>
</html>
