-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCSS-child-selectors.html
47 lines (42 loc) · 1.3 KB
/
CSS-child-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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CSS Child Selectors</title>
<style>
article h3{
color: tomato;
}
article > p{
background-color: aquamarine;
}
</style>
</head>
<body>
<h1>Descendant Selector</h1>
<p>
<strong><q>article h3</q></strong> <br>
The article h3 selector is a descendant selector, only selecting h3 elements that fall inside of an article element.
</p>
<article>
<h3>Hello World</h3>
<h2>Welcome</h2>
<h3>Hello Again</h3>
<p>Follow your passion</p>
</article>
<hr>
<h1>Direct Child Selector</h1>
<p>
<strong><q>article p</q></strong> <br>
article > p is a direct child selector only identifying p elements that fall directly within an article element. Any p element placed outside of an article element, or nested inside of another element other than the article element, will not be selected.</p>
<article>
<h4>Hey you!!!</h4>
<p>Don't waste time</p>
</article>
<div>
<p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. In nihil labore illum odit libero doloremque similique, maiores sint suscipit voluptates aspernatur tenetur unde corporis? Totam, reiciendis tenetur! Officiis, unde officia.</p>
</div>
<hr>
</body>
</html>