-
Notifications
You must be signed in to change notification settings - Fork 0
/
02_basic_selectors.html
80 lines (71 loc) · 2.14 KB
/
02_basic_selectors.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Basic Selectors</title>
<style>
/* first way to make a selector (is not necessary to put h2 element) [h2] */
h2#green-heading {
color: green;
}
/* "#" apply only one id element */
/* second way to make a selector */
#blue-heading {
color: blue;
}
/* "." is for class and apply to all elements */
.red-heading {
color: red;
}
.double-style {
font-size: 10px;
}
/*
aplies to all h3 with class nest
class style are over element style
*/
h3.nest {
color: gold;
}
/* Multiple selectors */
#welcome, #about {
border: 1px solid #ccc;
padding: 10px;
margin-bottom: 5px;
}
/* Nested selectors */
#welcome p {
font-size: 20px;
}
/* any element h5 that is contained in in div no matter how many child elements it has */
div h5 {
color: greenyellow;
}
</style>
</head>
<body>
<div id="welcome">
<h2 id="green-heading">Welcome to CSS sandbox!!!</h2>
<h3 class="nest double-style">
Lorem ipsum dolor sit amet.
<h3>class style are over element style</h3>
</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Laboriosam fugit libero corporis delectus atque ad commodi magni exercitationem quisquam optio.</p>
</div>
<div id="about">
<h2 id="blue-heading">About</h2>
<div>
<h4>
Lorem, ipsum dolor.
<h5>Lorem, ipsum.</h5>
</h4>
</div>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam harum at quod cupiditate tempora sequi officiis repudiandae autem dignissimos consectetur!</p>
</div>
<div>
<h2 class="red-heading">Contact</h2>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam harum at quod cupiditate tempora sequi officiis repudiandae autem dignissimos consectetur!</p>
</div>
</body>
</html>