-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcss-content-position.html
124 lines (112 loc) · 3.94 KB
/
css-content-position.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
116
117
118
119
120
121
122
123
124
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>CSS3 flexbox content positioning codility task</title>
<meta name="description" content="CSS3 flexbox positoning" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" type="text/css" href="solution.css">
<style>
body {
background: #3f4040;
width: 100%;
margin: 0;
}
.container {
overflow: auto;
display: flex;
flex-direction: row;
width: 100%;
}
.container:nth-child(2) {
justify-content: space-between;
}
.outer-centered {
margin: 5%;
height: 250px;
box-sizing: border-box;
background: #fff;
text-align: left;
width: 50%;
display: flex;
justify-content: center;
align-items: center;
}
.outer-centered .inner {
justify-content: center;
align-items: center;
text-align: center;
}
.outer-left {
width: 45%;
height: 250px;
box-sizing: border-box;
background: purple;
text-align: left;
display: flex;
flex-direction: column;
justify-content: flex-end;
}
.outer-left .inner {
justify-content: flex-end;
align-items: flex-end;
}
.outer-right {
width: 35%;
height: 250px;
box-sizing: border-box;
background: green;
text-align: left;
display: flex;
flex-direction: row;
justify-content: flex-end;
}
.outer-right .inner {
justify-content: flex-end;
align-items: flex-end;
text-align: right;
align-self: end;
}
.inner {
width: 300px;
height: 150px;
display: flex;
}
.outer-centered .inner {
border: 2px solid red;
}
.outer-left .inner {
border: 2px solid white;
}
.outer-right .inner {
border: 2px solid yellow;
}
</style>
</head>
<body>
<div class="container">
<div class="outer-centered">
<div class="inner">
`outer-centered inner` elements (shown as red square boxes) should be horizontally and vertically centered inside the parent `outer` (shown as a white box). Their content (this text) should be also horizontally and vertically centered inside the parent (red square box).
</div>
</div>
<div class="outer-centered">
<div class="inner">
`outer-centered inner` elements (shown as red square boxes) should be horizontally and vertically centered inside the parent `outer` (shown as a white box). Their content (this text) should be also horizontally and vertically centered inside the parent (red square box).
</div>
</div>
</div>
<div class="container">
<div class="outer-left">
<div class="inner">
`outer-left inner` element (shown as a white square box) should be positioned on the left and bottom of the parent `outer` (shown as a purple box). Its content (this text) should be aligned to the left side and the bottom of the parent `inner` (white square box).
</div>
</div>
<div class="outer-right">
<div class="inner">
`outer-right inner` element (shown as a yellow square box) should be positioned on the right and bottom of the parent `outer` (show as a green box). Its content (this text) should be aligned to the right side and the bottom of the parent `inner` (yellow square box).
</div>
</div>
</div>
</body>
</html>