-
Notifications
You must be signed in to change notification settings - Fork 0
/
practice_05.css
84 lines (82 loc) · 1.85 KB
/
practice_05.css
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
.percentage {
background-color: blue;
height: 100px;
width: 100px;
font-size: 10px;
}
.percentage_01{
background-color: yellow;
/* height: 50%; */
width: 50%;
font-size: 2em;
/* 2times of parent font size */
margin: 10%;
width: 5em;
/* 5 times of width */
}
.percentage_01 {
margin: 2rem;
/* font size of root element */
height: 50vh;
/* 50vh means that 50%of the hole screen */
}
/* static ==> Default position (The top, right, bottom, left, and x-index properties have no effect)
relative ==> element is relative to itself. (The top, right, bottom, left and z-index will work)
absolute ==> position relative to it closest positioned ancestor. (removed from
fixed ==> positioned relative to browser. (removed from flow
sticky ==> position based on user's scroll position
*/
*{
margin: 0px;
padding: 0px;
}
/* div {
background-color: aqua;
height: 100px;
width: 100px;
margin: 10px;
border: 2px solid blue;
display: inline-block;
} */
.box4{
position: static;
/* for static does not change*/
top: 10px;
left: 10px;
}
.box5
{
position: relative;
top: 10px;
left: 10px;
}
.box6 {
position: absolute;
/* box 7 shifted to the back side of the box 6 */
z-index: 5;
top: 100px;
/* closest position to the ancester(closest position to body) */
right: 10px;
}
.box7 {
position: fixed;
top: 0px;
right: 0px;
}
.box8 {
position: sticky;
top: 0px;
background-image: url("game.jpg");
background-size: cover;
background-repeat: no-repeat;
}
.div_hai {
height: 100px;
width: 100px;
background-image: url("mahabharat.jpg");
background-size: cover;
position: fixed;
top: 50px;
right: 0px;
color: white;
}