-
Notifications
You must be signed in to change notification settings - Fork 0
/
cemterelement.html
115 lines (91 loc) · 5.54 KB
/
cemterelement.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>center elements</title>
<link rel="stylesheet" href="css/media.css">
<link rel="stylesheet" href="css/centerelements.css">
</head>
<body>
<nav>
<ul>
<li><a href="index.html">index</a></li>
<li><a href="width&height.html">width&height</a></li>
<li><a href="position.html">position</a></li>
<li><a href="margin&padding.html">margin&padding</a></li>
<li><a href="font.html">font</a></li>
<li><a href="border.html">border</a></li>
<li><a href="cemterelement.html">cemterelement</a></li>
</ul>
</nav>
<br><br><br><br><br>
<h1 style="text-align: center;">Center element use position</h1>
<div class="container" style="position: relative;height: 400px; background-color: rgb(218, 218, 218); padding: 0;">
<div class="etl" style="width: 40px; height: 40px; background-color: red; position: absolute; "></div>
<div class="etc" style="width: 40px; height: 40px; background-color: red; position: absolute; "></div>
<div class="etr" style="width: 40px; height: 40px; background-color: red; position: absolute; "></div>
<div class="ecl" style="width: 40px; height: 40px; background-color: red; position: absolute; "></div>
<div class="ecc" style="width: 40px; height: 40px; background-color: red; position: absolute; "></div>
<div class="ecr" style="width: 40px; height: 40px; background-color: red; position: absolute; "></div>
<div class="ebl" style="width: 40px; height: 40px; background-color: red; position: absolute; "></div>
<div class="ebc" style="width: 40px; height: 40px; background-color: red; position: absolute; "></div>
<div class="ebr" style="width: 40px; height: 40px; background-color: red; position: absolute; "></div>
</div>
<br><br><br><br><br>
<h1 style="text-align: center;">Center element use position -50%</h1>
<div class="container" style="position: relative;height: 400px; background-color: rgb(218, 218, 218); padding: 0;">
<div class="etlo" style="width: 40px; height: 40px; background-color: red; position: absolute; "></div>
<div class="etco" style="width: 40px; height: 40px; background-color: red; position: absolute; "></div>
<div class="etro" style="width: 40px; height: 40px; background-color: red; position: absolute; "></div>
<div class="eclo" style="width: 40px; height: 40px; background-color: red; position: absolute; "></div>
<div class="ecco" style="width: 40px; height: 40px; background-color: red; position: absolute; "></div>
<div class="ecro" style="width: 40px; height: 40px; background-color: red; position: absolute; "></div>
<div class="eblo" style="width: 40px; height: 40px; background-color: red; position: absolute; "></div>
<div class="ebco" style="width: 40px; height: 40px; background-color: red; position: absolute; "></div>
<div class="ebro" style="width: 40px; height: 40px; background-color: red; position: absolute; "></div>
</div>
<br><br><br><br><br>
<h1 style="text-align: center;">Center element use flex</h1>
<div class="container"
style="position: relative;height: auto; background-color: rgb(218, 218, 218); padding: 0; display: flex ; gap: 20px;flex-wrap: wrap; justify-content: center;">
<div style="display: flex; gap: 20px;">
<div class="etlf" style="width: 200px; height: 200px; background-color: red; ">
<div style="width: 50px; height: 50px; background-color: gray;"></div>
</div>
<div class="etcf" style="width: 200px; height: 200px; background-color: red; ">
<div style="width: 50px; height: 50px; background-color: gray;"></div>
</div>
<div class="etrf" style="width: 200px; height: 200px; background-color: red; ">
<div style="width: 50px; height: 50px; background-color: gray;"></div>
</div>
</div>
<div style="display: flex; gap: 20px;">
<div class="eclf" style="width: 200px; height: 200px; background-color: red; ">
<div style="width: 50px; height: 50px; background-color: gray;"></div>
</div>
<div class="eccf" style="width: 200px; height: 200px; background-color: red; ">
<div style="width: 50px; height: 50px; background-color: gray;"></div>
</div>
<div class="ecrf" style="width: 200px; height: 200px; background-color: red; ">
<div style="width: 50px; height: 50px; background-color: gray;"></div>
</div>
</div>
<div style="display: flex; gap: 20px;">
<div class="eblf" style="width: 200px; height: 200px; background-color: red; ">
<div style="width: 50px; height: 50px; background-color: gray;"></div>
</div>
<div class="ebcf" style="width: 200px; height: 200px; background-color: red; ">
<div style="width: 50px; height: 50px; background-color: gray;"></div>
</div>
<div class="ebrf" style="width: 200px; height: 200px; background-color: red; ">
<div style="width: 50px; height: 50px; background-color: gray;"></div>
</div>
</div>
</div>
<br><br><br><br><br>
<br><br><br><br><br>
<br><br><br><br><br>
</body>
</html>