-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflex.html
More file actions
396 lines (324 loc) · 8.42 KB
/
flex.html
File metadata and controls
396 lines (324 loc) · 8.42 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
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
<!DOCTYPE html>
<html lang="en">
<head>
<title>Flex layout</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<style>
/* The following CSS applies on all screen sizes */
/* Colors and fonts */
:root {
/* Fonts */
--bodyfont: sans-serif;
--headerfont: Georgia, serif;
/* Main colors */
--background:#5a094a; /* Page background */
--color:#2f152f;
--block:#f9f8f9; /* Background color for the grid blocks in the content */
--link:#5a094a;
--linkhover:#a649a9;
--h1:#2f152f;
--h2:#2f152f;
--h3:#2f152f;
--h4:#2f152f;
/* Sidebar colors */
--sidebar:#f9f8f9;
--sidebarcolor:#2f152f;
--title: #5a094a;
--sidebarlink: #5a094a;
--sidebarlinkhover:#a649a9;
/* Menu colors */
--menubg:#2c1a30;
--menucolor:#e0aee2;
--menubghover:#e0aee2;
--menucolorhover:#2c1a30;
}
* { margin:0; padding:0; }
/* Main body styling */
body {
background-color:var(--background);
background-attachment:fixed;
font:1rem sans-serif;
color:var(--color);
}
/* Rounded corners - feel free to get rid of this or change it */
main section, #sidebar-content, #main-footer {
border-radius:5px;
}
/* Sidebar styling */
#sidebar-content {
text-align:center;
background: var(--sidebar);
color: var(--sidebarcolor);
padding:10px;
}
#sidebar-content header {
color:var(--title);
font:1.8em var(--headerfont);
margin:8px;
}
#sidebar-content p a {
color:var(--sidebarlink);
transition:0.5s ease;
}
#sidebar-content p a:hover {
color:var(--sidebarlinkhover);
transition:0.5s ease;
}
.icon img {
border-radius:100%; /* This makes the icon a circle - feel free to remove or reduce for a rectangle or square */
max-width:150px; /* This can be changed to make the icon smaller; you might have to mess with the border radius too */
}
/* Styling for the menu */
#main-menu {
font:1.1em var(--headerfont);
width:100%;
}
#main-menu ul {
list-style:none;
}
#main-menu li a {
padding:7px;
background:var(--menubg);
color:var(--menucolor);
text-decoration:none;
transition:0.5s ease;
}
#main-menu li a:hover, #main-menu li a:focus {
background: var(--menubghover);
color:var(--menucolorhover);
transition:0.5s ease;
}
/* Content styling */
main {
margin-top:10px;
}
/* Styling for blocks */
main section, #main-footer {
padding:15px;
background:var(--block);
margin-bottom:10px;
}
main h1 {
font:1.8em var(--headerfont);
color:var(--h1);
}
main h2 {
font:1.5em var(--headerfont);
color:var(--h2);
}
main h3 {
font:1.3em var(--headerfont);
color:var(--h3);
}
main h4 {
font:1em var(--headerfont);
font-style:italic;
color:var(--h4);
}
p {
line-height:1.5;
margin:10px 0 10px 0;
}
main a {
color:var(--link);
transition:0.5s ease;
}
main a:hover, main a:focus {
color:var(--linkhover);
transition:0.5s ease;
}
main ul {
list-style-position: outside;
margin-left: 25px;
}
main ul li {
line-height:1.5;
}
main img {
max-width:100%;
}
main input, textarea, select, button {
background: var(--block);
color: var(--color);
font: 1rem var(--bodyfont);
border: 1px solid;
padding: 8px;
margin: 2px;
}
#main-footer {
text-align:center;
}
/* The following CSS ONLY applies to mobile/small screens */
/* Container styling */
#container {
width: calc(100% - 20px);
padding:10px;
margin-top:10px;
}
#sidebar-content {
width: calc(100% - 20px);
}
#main-menu li {
margin-bottom:15px;
display:inline-block;
}
/* Skip to content button */
#skip a {
position:absolute;
display:inline-block;
left:0px;
top:-1000px;
overflow:hidden;
transition:top 0.5s ease;
background:var(--block);
color:var(--link);
z-index:1000;
padding:5px;
}
#skip a:focus {
top: 0;
transition:top 0.5s ease;
}
/* The following CSS ONLY applies to desktop/big screens */
@media screen and (min-width: 800px) {
#container {
max-width:950px;
width:90%;
margin:25px auto;
display:flex;
gap:20px;
}
#sidebar {
flex: 1 1 calc(25% - 20px);
margin-top:10px;
}
/* Remove or comment out this block if you don't want a sticky sidebar */
#sidebar-content {
position:sticky;
top:10px;
}
/* Make menu links into a column */
#main-menu li {
display:block;
margin:0;
}
#main-menu li a {
display:block;
border-bottom:1px solid;
}
main {
flex: 1 1 calc(75% - 30px);
display:flex;
flex-wrap:wrap;
gap:10px;
}
main section {
margin:0;
}
#main-footer {
flex: 1 1 calc(100% - 40px);
}
/* Defining grid blocks */
.full { flex: 1 1 calc(100% - 40px);}
.half { flex: 1 1 calc(50% - 40px); }
.third { flex: 1 1 calc(33% - 40px); }
.twothird { flex: 1 1 calc(66% - 40px); }
.quarter { flex: 1 1 calc(25% - 40px); }
.threequarter { flex: 1 1 calc(75% - 40px); }
}
</style>
</head>
<body>
<!-- Please don't remove the next 2 lines! -->
<div id="top"></div>
<div id="skip"><a href="#content">Skip to content</a></div>
<div id="container">
<div id="sidebar">
<div id="sidebar-content">
<!-- An image can go here if you'd like, or just delete this line if you don't. It doesn't matter what size it is as long as it's square. -->
<div class="icon"><img src="https://placehold.co/150x150" alt="" /></div>
<header>Title</header>
<!-- Navigation menu -->
<nav id="main-menu">
<ul>
<li><a href="">Link</a></li>
<li><a href="">Longer link</a></li>
<li><a href="">Another link</a></li>
<li><a href="">Link</a></li>
</ul>
</nav>
<p>Text can go here. You can also add <a href="">inline links</a>. It's best not to make this too long because this moves to the top of the page on mobile.</p>
</div>
</div>
<!-- Content area -->
<main id="content">
<!-- Section tags must be used for blocks -->
<section class="full">
<h1>Header</h1>
<p>This is the base framework that I use for my character pages. Its main feature is that it allows you to easily make a grid with varying element widths, which is ironically something much more easily accomplished with flexbox than grid. It's also a fairly good Tumblr knockoff layout if you're into that.</p>
<p><a href="https://github.com/kayleconut/kalechips-resources/blob/main/layouts/flex.html">You can copy the source code for this from Github!</a> Or just take it from the view source page directly.</p>
</section>
<section class="full">
<h2>Mobile compatibility</h2>
<p>This layout uses mobile-first CSS, which means the main CSS is for smaller screens, while a @media tag defines the CSS for larger screens. I've marked out which CSS applies to which screen sizes in the code. </p>
</section>
<section class="half">
<h2>Half-width section</h2>
<p>This is a half-width section. All sections, regardless of their grid size, will take up the entire screen width on small screens (under 1024px wide). </p>
</section>
<section class="quarter">
<h2>Quarter-width section</h2>
<p>This is a quarter-width section. </p>
</section>
<section class="quarter">
<h2>Quarter-width section</h2>
<p>You can use 2 of these with a half-width section or 1 with a 3/4 width section.</p>
</section>
<section class="third">
<h2>Third-width section</h2>
<p>This is a third-width section.</p>
<ul>
<li>This</li>
<li>is</li>
<li>a</li>
<li>list
<ul>
<li>List</li>
<li>inside</li>
<li>of</li>
<li>list</li>
</ul></li>
</ul>
</section>
<section class="twothird">
<h2>2/3-width section</h2>
<p>This is a 2/3-width section. <a href="">This is a link.</a></li>
<p><input type="text" value="Input" /></p>
<p><select>
<option selected>Selection</option>
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
</select></p>
<p><textarea>Textarea</textarea></p>
<p><button type="button">Button</button></p>
</section>
<section class="threequarter">
<h2>3/4-width section</h2>
<h3>Header 3</h3>
<h4>Header 4</h4>
<p>This is a 3/4-width section.</p>
</section>
<section class="quarter">
<h2>Quarter-width section</h2>
<p>Are you bored yet?</p>
</section>
<footer id="main-footer">
<p>Footer text</p>
<p><a href="#top">Back to top</a> <span aria-hidden="true">•</span> <a href="#main-menu">Back to menu</a></p>
</footer>
</main>
</div>
</body>
</html>