Skip to content

Commit f94f406

Browse files
author
jsdnhk
committed
posted Jan 2021
1 parent 25cab9c commit f94f406

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

_data/pages_latest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
- name: blog
3-
mtime: 2-1-2021
3+
mtime: 2-2-2021
44
- name: debug
55
mtime: 12-10-2020
66
- name: fonts

collections/_posts/2021-02-02-post.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
title: "Flexible web layout"
3+
tags: [layout, web, angular]
4+
category: "layout"
5+
comment: true
6+
---
7+
8+
## Background
9+
10+
When we read the content from browser, it would render the content based on [CSS basic box model][css-box].
11+
12+
However, it needs many items and attributes to control the view, so it is complicated to setup and easy to get messed.
13+
14+
The problems from classic web layouts made web designers just using tricky and weird workaround to avoid.
15+
16+
As a result, W3C suggested using new web layout, [flex][flex-layout], to design HTML frontend, that provide an easier all-around solution.
17+
18+
Until now, flex layout has already became a major web layout used for modern web designers and framework.
19+
20+
The new layout is lesser properties to know and also smarter which many attributes are calculated by render engine.
21+
22+
The following is showing all the CSS attributes having in flex web layout, it's obviously a right layout solution.
23+
24+
## Properties
25+
26+
There are the properties contained in flex layout in YAML format.
27+
28+
```yaml
29+
---
30+
flex-container:
31+
axis:
32+
- main start/end(-)
33+
- cross start/end(|)
34+
attributes:
35+
flex-direction: [row, row-reverse, column, column-reverse]
36+
flex-wrap: [nowrap, wrap, wrap-reverse]
37+
flex-flow: "${flex-direction} ${flex-wrap}"
38+
justify-content: [flex-start, flex-end, center, space-between, space-around]
39+
align-items: [flex-start, flex-end, center, baseline, stretch]
40+
align-content: [stretch, flex-start, flex-end, center, space-between, space-around]
41+
flex-item:
42+
axis:
43+
- main size(-)
44+
- cross size(|)
45+
attributes:
46+
order: "<integer>"
47+
flex-grow: "<number>"
48+
flex-shrink: "<number>"
49+
flex-basis: "auto | <length>"
50+
flex: "${flex-grow} ${flex-shrink} ${flex-basis} | auto | none"
51+
align-self: [auto, flex-start, flex-end, center, baseline, stretch]
52+
---
53+
```
54+
55+
[flex-layout]: https://css-tricks.com/snippets/css/a-guide-to-flexbox/
56+
[css-box]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Model/Introduction_to_the_CSS_box_model

0 commit comments

Comments
 (0)