What's New In CSS?

A presentation at Fronteers W3C Meet-up in February 2019 in Amsterdam, Netherlands by Rachel Andrew

Slide 1

Slide 1

What’s New In CSS? Rachel Andrew, Fronteers 2019

Slide 2

Slide 2

Slides, code & resources https://noti.st/rachelandrew/ 9R7PMY

Slide 3

Slide 3

How do we get new CSS?

Slide 4

Slide 4

The CSS Working Group https://www.w3.org/Style/CSS/members

Slide 5

Slide 5

Discussion logged on GitHub https://github.com/w3c/csswg-drafts/issues

Slide 6

Slide 6

CSS Spec Levels Where is CSS4?

Slide 7

Slide 7

CSS Selectors Level 3 W3C Recommendation

Slide 8

Slide 8

CSS Selectors Level 4 Working Draft

Slide 9

Slide 9

There is no CSS4. https://rachelandrew.co.uk/archives/2016/09/ 13/why-there-is-no-css4-explaining-css-levels/

Slide 10

Slide 10

Phases to become a W3C Recommendation Working Draft (WD) Candidate Recommendation (CR) Proposed Recommendation (PR) W3C Recommendation (REC) https://www.w3.org/2018/Process-20180201/#maturity-levels

Slide 11

Slide 11

Multiplecolumn Layout https://www.w3.org/TR/css-multicol-1/

Slide 12

Slide 12

The Editor’s Draft The version that spec editors are making changes on. Commits show up right away – things may change!

Slide 13

Slide 13

Candidate Recommendation Gathering Implementation Experience.

Slide 14

Slide 14

To exit CR Status The specification needs two independent implementations of each feature.

Slide 15

Slide 15

Grid Layout https://www.w3.org/TR/css-grid-1/

Slide 16

Slide 16

Grid Layout Level 1 specification shipped by all major browsers in 2017. Level 1 specification is a Candidate Recommendation.

Slide 17

Slide 17

Grid Level 2 https://www.w3.org/TR/css-grid-2/

Slide 18

Slide 18

Subgrid Part of CSS Grid Level 2. CSS Grid Level 2 is a Working Draft.

Slide 19

Slide 19

Slide 20

Slide 20

Slide 21

Slide 21

Subgrid explained https://www.smashingmagazine.c om/2018/07/css-grid-2/

Slide 22

Slide 22

CSS Box Alignment https://www.w3.org/TR/css-align-3/

Slide 23

Slide 23

align-items justify-content Main and cross axis alignment when in flex layout. .flex { display: flex; align-items: center; justify-content: center; }

Slide 24

Slide 24

align-items justify-content Block and Inline axis alignment when in grid layout. .grid { display: grid; align-items: start; justify-content: space-between; }

Slide 25

Slide 25

gap, row-gap, column-gap Gutters or alleys between items in a layout.

Slide 26

Slide 26

Gaps in Grid Layout .grid { display: grid; grid-template-columns: 1fr 1fr 1fr; grid-column-gap: 20px; grid-row-gap: 20px; }

Slide 27

Slide 27

Slide 28

Slide 28

Gaps in Grid Layout .grid { display: grid; grid-template-columns: 1fr 1fr 1fr; column-gap: 20px; row-gap: 20px; }

Slide 29

Slide 29

Gaps in Flex Layout .flex { display: flex; flex-wrap: wrap; column-gap: 20px; row-gap: 20px; }

Slide 30

Slide 30

Slide 31

Slide 31

Intrinsic Sizing Keywords

Slide 32

Slide 32

min-content .grid { display: grid; grid-template-columns: repeat(3, min-content); row-gap: 20px; column-gap: 20px; }

Slide 33

Slide 33

Slide 34

Slide 34

max-content .grid { display: grid; grid-template-columns: repeat(3, max-content); row-gap: 20px; column-gap: 20px; }

Slide 35

Slide 35

Slide 36

Slide 36

fit-content .grid { display: grid; grid-template-columns: repeat(3, fit-content(10em)); row-gap: 20px; column-gap: 20px; }

Slide 37

Slide 37

Slide 38

Slide 38

Sizing strings .min { width: min-content; } .max { width: max-content; }

Slide 39

Slide 39

Slide 40

Slide 40

Scroll Snap https://www.w3.org/TR/css-scroll-snap-1/

Slide 41

Slide 41

Scroll Snap Snapping on the x axis body { display: flex; overflow-x: scroll; scroll-snap-type: x mandatory; } img { width: 31vw; height: 300px; margin: 0 3.5vw 0 0; object-fit: cover; scroll-snap-align: start; }

Slide 42

Slide 42

Slide 43

Slide 43

Scroll Snap Snapping on the y axis .list { height: 400px; width: 250px; overflow-y: scroll; scroll-snap-type: y mandatory; } .list li { scroll-snap-align: start; }

Slide 44

Slide 44

Slide 45

Slide 45

Scrollbars https://www.w3.org/TR/css-scrollbars-1/

Slide 46

Slide 46

scrollbar-color .list { height: 400px; width: 250px; overflow-y: scroll; scrollbar-color: rebeccapurple hotpink; }

Slide 47

Slide 47

Slide 48

Slide 48

scrollbar-width .list { height: 400px; width: 250px; overflow-y: scroll; scrollbar-width: thin; scrollbar-color: rebeccapurple hotpink; }

Slide 49

Slide 49

Slide 50

Slide 50

Conic Gradients https://www.w3.org/TR/css-images-4/

Slide 51

Slide 51

Conic Gradients A cone .cone { width: 200px; height: 200px; background: conic-gradient(orange, green, orange); border-radius: 50%; margin: 20px; }

Slide 52

Slide 52

Slide 53

Slide 53

Conic Gradients A chart .chart { width: 200px; height: 200px; background: conic-gradient(red 35%, green 35%, green 65%, orange 65%, orange 90%, yellow 90%); border-radius: 50%; margin: 20px; }

Slide 54

Slide 54

Slide 55

Slide 55

Conic Gradients Pacman! .pacman { width: 200px; height: 200px; background: conic-gradient(yellow 0%, yellow 15%, white 15%, white 35%, yellow 35%); border-radius: 50%; margin: 20px; }

Slide 56

Slide 56

Slide 57

Slide 57

http://leaverou.github.io/conic-gradient/

Slide 58

Slide 58

Media Queries https://www.w3.org/TR/mediaqueries-4/

Slide 59

Slide 59

@media (pointer:coarse) { } Media Features @media (pointer:fine) { } @media (hover) { } What features does this device have? @media (hover:none) { }

Slide 60

Slide 60

Slide 61

Slide 61

Firefox DevTools Tools for designing with CSS.

Slide 62

Slide 62

Firefox Nightly https://www.mozilla.org/en-US/firefox/channel/desktop/

Slide 63

Slide 63

Slide 64

Slide 64

Check out these tools Grid, Flexbox, CSS Shapes, Variable Fonts https://developer.mozilla.org/en-US/docs/Tools

Slide 65

Slide 65

What’s next?

Slide 66

Slide 66

Aspect Ratio Units

Slide 67

Slide 67

Aspect Ratio Units https://drafts.csswg.org/css-sizing-4/#ratios

Slide 68

Slide 68

Exclusions

Slide 69

Slide 69

Exclusions Flow text round all sides of an element .exclusion { wrap-flow: both; }

Slide 70

Slide 70

Exclusions Flow text round all sides of an element .exclusion { -ms-wrap-flow: both; }

Slide 71

Slide 71

Slide 72

Slide 72

Editorial layouts, exclusions & CSS Grid https://rachelandrew.co.uk/archives/2018/11/09/editorial-layouts-exclusions-and-css-grid/

Slide 73

Slide 73

CSS Houdini Extend CSS with JavaScript!

Slide 74

Slide 74

https://css-houdini.rocks/conic-gradient

Slide 75

Slide 75

https://css-houdini.rocks/corners-gradient

Slide 76

Slide 76

https://googlechromelabs.github.io/houdini-samples/layout-worklet/masonry/

Slide 77

Slide 77

http://houdini.glitch.me/

Slide 78

Slide 78

https://ishoudinireadyyet.com/

Slide 79

Slide 79

How to influence the process

Slide 80

Slide 80

Tell us what you want Talk to the CSS Working Group! Talk to me and I’ll talk to the CSS Working Group.

Slide 81

Slide 81

Tell browsers what you want • • • • Raise issues Add new use cases to issues Write and talk about new CSS Use the features!

Slide 82

Slide 82

Thank you! https://noti.st/rachelandrew/9R7PMY @rachelandrew