Skip to content

Commit 6f3bd46

Browse files
Holy grail layout
1 parent e62e678 commit 6f3bd46

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

FE-JS-Questions/HolyGrail.md

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
## Holy Grail Layout
2+
3+
```
4+
===========================================================================
5+
=============================== HEADER ====================================
6+
===========================================================================
7+
================== ==================================== ===================
8+
================== ==================================== ===================
9+
================== ==================================== ===================
10+
================== ==================================== ===================
11+
==== SIDEBAR 1==== ============ ARTICLE =============== ==== SIDEBAR 2=====
12+
================== ==================================== ===================
13+
================== ==================================== ===================
14+
================== ==================================== ===================
15+
================== ==================================== ===================
16+
===========================================================================
17+
=============================== FOOTER ====================================
18+
===========================================================================
19+
```
20+
21+
### Using CSS Grid
22+
```html
23+
<div class="Holy-Grail-Grid">
24+
<section class="header">HEADER</section>
25+
<aside class="left-sidebar">SIDEBAR 1</aside>
26+
<section class="container article">ARTICLE</section>
27+
<aside class="right-sidebar">SIDEBAR 2</aside>
28+
<section class="footer">FOOTER</section>
29+
</div>
30+
```
31+
32+
```css
33+
.Holy-Grail-Grid {
34+
display: grid;
35+
grid-template-columns: 100px auto 100px;
36+
grid-template-rows: repeat(3, 100px);
37+
grid-gap: 1em;
38+
}
39+
40+
.header, .footer {
41+
grid-column: 1 / span 3;
42+
}
43+
```
44+
45+
### Using CSS Flexbox
46+
```html
47+
<div class="Holy-Grail-Flex">
48+
<header class="header">HEADER</header>
49+
<div class="Container">
50+
<nav class="left-sidebar">SIDEBAR 1</nav>
51+
<section class="body">ARTICLE</section>
52+
<aside class="right-sidebar">SIDEBAR 2</aside>
53+
</div>
54+
<footer class="footer">FOOTER</footer>
55+
</div>
56+
```
57+
58+
```css
59+
.Holy-Grail-Flex,
60+
.Container {
61+
display: flex;
62+
flex-direction: column;
63+
}
64+
65+
@media(min-width: 768px) {
66+
.Container {
67+
flex-direction: row;
68+
flex: 1;
69+
}
70+
.body {
71+
flex: 1;
72+
}
73+
.left-sidebar, .right-sidebar {
74+
flex: 0 0 12em;
75+
}
76+
}
77+
```

0 commit comments

Comments
 (0)