-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathposition.html
More file actions
82 lines (78 loc) · 2.02 KB
/
Copy pathposition.html
File metadata and controls
82 lines (78 loc) · 2.02 KB
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
<!--can set div style to a background color to get an idea of the flexbox or grid or position-->
<!--position fixed = elements placed in browser window, helps keep something on the page even when scrolling-->
<!--position absolute = elements placed on the page. Relative position = an absolute element go into fixed element or a absolute go into a relative element-->
<!--can put position absolute into position fixed element-->
<!--z index helps put which element in front or behind, 0 is default and number goes up-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Position practice</title>
</head>
<body style="
height: 3000px;
padding-top: 60px;
padding-left: 80px;
">
<div style="background-color: black;
color: white;
position: fixed;
top: 0px;
left: 0px;
right: 0px;
height: 50px;
z-index: 1;"
>header</div>
<div style="
background-color: green;
color: white;
position: fixed;
left: 0px;
bottom: 0px;
top: 50px;
width: 72px
">
sidebar
<div style="
position: absolute;
background-color: red;
color: white;
top: 0px;
right: 0px;
z-index: 2;">
x
</div>
</div>
<div style="
position: absolute;
background-color: red;
color: white;
top: 60px;
right: 10px;
z-index: 2;">
absolute
</div>
<div style="background-color: lightblue;
height: 200px;
width: 200px;
position: static;"
>div 1</div>
<div style="background-color: lightpink;
height: 200px;
width: 200px;
position: relative;
">
div 2
<div style="
position: absolute;
background-color: black;
color: white;
z-index: 2;
bottom: 10px;
right: 10px">
5:00
</div>
</div>
</body>
</html>