-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01_example.html
51 lines (39 loc) · 1.59 KB
/
01_example.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
<!-- hello guys in this code series you will learn different concepts of intermediate CSS. For better understanding run all code of this code series in browser. -->
<!-- I think you already know about selectors like universal selector(*), element selctor, id selector, group selector .... but in this code you learn about combinators in css.
let's take a look at combinators.
combinators : is somthing that explains the relationship between the selectors.
There are four different combinators :-
1. Descendant combinator -> (white space)
2. Child combinator -> ( > )
3. Adjacent sibling combinator -> ( + )
4. General sibling combinator -> ( ~ )
-->
<!-- 1. Descendant combinator -> (white space) : as name suggested descendant("purvaj") it will select all child elements as well as its super child elements -->
<!DOCTYPE html>
<html>
<head>
<title>CSS BY EXAMPLES</title>
<style>
div p{
/* use of descendant combinator by using a white space between div and p */
background-color: rgb(255, 212, 167);
color: rgb(14, 29, 74);
}
</style>
</head>
<body>
<h2>Descendant combinator </h2>
<p>
The descendant combinator matches all elements that are descendants of a
specified element.
</p>
<div>
<p>child 1 in the div.</p>
<p>child 2 in the div.</p>
<section><p>super child in the div.</p></section>
</div>
<p>sibling 1 of a div.</p>
<p>sibling 2 of a div.</p>
</body>
</html>
<!-- TASK : Add a super child element in this code and apply css on it by using descendant combinator. -->