the new css layout · web developer since 1996, teaching css for almost as long. co-founder perch...

44
Slides & Code at https://noti.st/rachelandrew The New CSS Layout Rachel Andrew @rachelandrew

Upload: others

Post on 20-Jul-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

The New CSS LayoutRachel Andrew@rachelandrew

Page 2: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

I do web stuff.Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine Editor in Chief. Writer for MDN. CSS Working Group Invited Expert. Google Developer Expert. I like long runs and small airplanes.

Page 3: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

A layout system for CSSFor the first time!

Page 4: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

A layout system for CSS

FlexboxGrid LayoutMultiple-column LayoutFloatsCSS Positioned Layout

Page 5: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

Brought together by …

Box AlignmentIntrinsic and Extrinsic SizingLogical Properties and Values

Page 6: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

FlexboxLayout in one dimension. A row or a column.

Page 7: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

Page 8: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

https://codepen.io/rachelandrew/pen/qMYqYL

Inline Dimension

.flex {display: flex;width: 500px;

}

Page 9: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

.flex {writing-mode: vertical-rl;display: flex;width: 500px;

}

Page 10: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

https://codepen.io/rachelandrew/pen/XPqjpX

Block Dimension

.flex {writing-mode: vertical-rl;display: flex;width: 500px;

}

Page 11: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

.flex {writing-mode: vertical-rl;display: flex;flex-direction: column;

}

Page 12: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

https://codepen.io/rachelandrew/pen/JavRqM

Block Dimension.flex {

writing-mode: vertical-rl;display: flex;flex-direction: column;

}

Page 13: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

Start Left to Right

Page 14: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

Start Right to Left

Page 15: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

.flex {display: flex;width: 500px;justify-content: flex-end;

}.flex-vertical {

writing-mode: vertical-rl;width: auto;inline-size: 500px;

}

Page 16: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

https://codepen.io/rachelandrew/pen/GXdjNd

BlockInline.flex {display: flex;width: 500px;justify-content: flex-end;

}

.flex-vertical {writing-mode: vertical-rl;width: auto;inline-size: 500px;

}

Page 17: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

.flex {display: flex;width: 500px;justify-content: space-between;

}.flex-vertical {

writing-mode: vertical-rl;width: auto;inline-size: 500px;

}

Page 18: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

https://codepen.io/rachelandrew/pen/ZMoBGe

BlockInline.flex {display: flex;width: 500px;justify-content: space-between;

}

.flex-vertical {writing-mode: vertical-rl;width: auto;inline-size: 500px;

}

Page 19: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

.flex {display: flex;align-items: flex-start;

}

.flex-vertical {writing-mode: vertical-rl;

}

Page 20: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

https://codepen.io/rachelandrew/pen/dqeOXg

BlockInline.flex {display: flex;align-items: flex-start;

}

.flex-vertical {writing-mode: vertical-rl;

}

Page 21: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

.flex {display: flex;align-items: center;justify-content: center;

}

Page 22: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

https://codepen.io/rachelandrew/pen/VGxmKq

.flex {display: flex;align-items: center;justify-content: center;

}

Page 23: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

CSS Grid LayoutLayout in two dimensions. Rows and Columns.

Page 24: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

.grid {display: grid;width: 500px;grid-template-columns: .2fr .2fr .4fr;grid-template-rows: 100px 100px;grid-gap: 20px;

}

Page 25: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

https://codepen.io/rachelandrew/pen/mGLOKd

.grid {display: grid;width: 500px;grid-template-columns: .2fr .2fr .4fr;grid-template-rows: 100px 100px;grid-gap: 20px;

}

Page 26: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

Page 27: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

Firefox Grid Inspectorhttps://developer.mozilla.org/en-US/docs/Tools/Page_Inspector/How_to/Examine_grid_layouts

Page 28: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

Page 29: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

.grid {display: grid;width: 500px;height: 300px;grid-template-columns: .2fr .2fr .4fr;grid-template-rows: 100px 100px;grid-gap: 20px;justify-content: end;align-content: center;

}.grid.vertical {

writing-mode: vertical-rl;width: auto;inline-size: 500px;block-size: 300px;

}

Page 30: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

https://codepen.io/rachelandrew/pen/PdebXZ

BlockInline.grid {display: grid;width: 500px;height: 300px;grid-template-columns: .2fr .2fr .4fr;grid-template-rows: 100px 100px;grid-gap: 20px;justify-content: end;align-content: center;

}.grid.vertical {writing-mode: vertical-rl;width: auto;inline-size: 500px;block-size: 300px;

}

Page 31: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

.grid {display: grid;width: 500px;grid-template-columns: 1fr 1fr 2fr;grid-template-rows: 100px 100px;grid-gap: 20px;align-items: start;justify-items: end;

}.grid.vertical {

writing-mode: vertical-rl;width: auto;inline-size: 500px;

}

Page 32: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

https://codepen.io/rachelandrew/pen/mGLRRr

BlockInline.grid {display: grid;width: 500px;grid-template-columns: 1fr 1fr 2fr;grid-template-rows: 100px 100px;grid-gap: 20px;align-items: start;justify-items: end;

}.grid.vertical {writing-mode: vertical-rl;width: auto;inline-size: 500px;

}

Page 33: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

.grid {display: grid;width: 500px;grid-template-columns: 1fr 1fr 2fr;grid-template-rows: 100px 100px 100px;grid-gap: 20px;

}.grid.rtl {

direction: rtl;}.grid div:nth-child(1) {

grid-column: 1 / 3;grid-row: 1 / 3;

}.grid div:nth-child(2) {

grid-column: -1 / -3;grid-row: -1 / -3;

}

Page 34: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

https://codepen.io/rachelandrew/pen/GXdWpQ

.grid {display: grid;width: 500px;grid-template-columns: 1fr 1fr 2fr;grid-template-rows: 100px 100px 100px;grid-gap: 20px;

}.grid.rtl {direction: rtl;

}.grid div:nth-child(1) {grid-column: 1 / 3;grid-row: 1 / 3;

}.grid div:nth-child(2) {grid-column: -1 / -3;grid-row: -1 / -3;

}

Page 35: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

https://codepen.io/rachelandrew/pen/GXdWpQ

Left to Right Right to Left

Page 36: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

A true system for layoutDesigned for the job. Writing mode aware. Consistent.

Page 37: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

What’s next?CSS Grid Level 2 “subgrids”

Page 38: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

Page 39: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

What’s next?Logical Properties & Values

Page 40: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

Page 41: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

What’s next?Box Alignment in Block Layout

Page 42: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

What’s next?What’s important to you?

Page 43: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

Page 44: The New CSS Layout · Web developer since 1996, teaching CSS for almost as long. Co-founder Perch CMS & Notist. Author or co-author of 23 books on web development. Smashing Magazine

Slides & Code at https://noti.st/rachelandrew

Thank you!https://noti.st/rachelandrew/SIXCfs