-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCSS Selector.html
84 lines (71 loc) · 1.64 KB
/
CSS Selector.html
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS selectors</title>
<style>
/* Element Selector */
div{
/* background-color: red;*/
}
/* Class selector*/
.red{ /* [.red means class is red]*/
background-color: red;
}
/*ID selector*/
#green{
background-color: green;
}
/*child selector*/
div > p {
color: blue;
background-color: brown;
}
/* descendant Selector*/
div p {
color: blue;
background-color: brown;
}
/* Universal Selector */
*{
margin: 0;
padding: 0;
}
/* pseudo Selector */
a:visited{
color: yellow;
}
a:link {
color: green;
}
a:active{
color: red;
}
a:hover{
color: orange;
}
p:first-child{
background-color: aqua;
}
</style>
</head>
<body>
<main class="one">
<p>i am first</p>
<p>i am second</p>
</main>
<div id="green">
<article>
I am a div
<p>I am a para inside div</p>
</article>
</div>
<div class="red">
hello world
<p>I am hero</p>
</div>
<a href="https://www.Google.com">Go to Google</a>
<a href="https://www.Facebook2.com">Go to Facebook</a>
</body>
</html>