-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathattributeSelectors.html
More file actions
70 lines (59 loc) · 1.6 KB
/
attributeSelectors.html
File metadata and controls
70 lines (59 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!-- Attribute - Presence and value selectors -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Attribute Selectors</title>
<style>
* {
margin: 0px;
padding: 0px;
}
body {
background-color: antiquewhite;
font-family: sans-serif;
}
h1 {
margin-top: 10px;
margin-bottom: 20px;
text-align: center;
}
ul {
list-style-type: none;
padding: 50px;
border: 2px solid salmon;
font-size: 1.5rem;
margin: 50px;
line-height: 2rem;
}
li {
display: inline-block;
margin: 1.2rem;
}
/* All attributed lists who belongs to any class */
li[class] {
color: darkviolet;
}
/* All list attributes who belongs to class a only */
li[class="a"] {
border: 3px solid black;
border-radius: 10px;
padding: 5px;
}
/* All li attributes from class a and other separated classes */
li[class~="a"] {
background-color: rgba(222, 170, 170, 0.6);
}
</style>
</head>
<body>
<h1>Attribute presence and value selectors</h1>
<ul>
<li>Item 1</li>
<li class="a">Item 2</li>
<li class="a b">Item 3</li>
<li class="ab">Item 4</li>
</ul>
</body>
</html>