Status of CSS Grid Layout Implementation

A presentation at BlinkOn 6 in June 2016 in Munich, Germany by Manuel Rego Casasnovas

Slide 1

Slide 1

S T A T U S

O F C S S

G R I D

L A Y O U T I M P L E M E N T A T I O N M A N U E L

R E G O

C A S A S N O V A S

( ) @ r e g o c a s B l i n k O n

6

/

1 6

1 7

J u n e

2 0 1 6

( M u n i c h )

Slide 2

Slide 2

A B O U T

M E C S S

G r i d

L a y o u t

i m p l e m e n t o r

( C h r o m i u m / B l i n k

& S a f a r i / W e b K i t ) M e m b e r

o f

I g a l i a

W e b

P l a t f o r m

T e a m

Slide 3

Slide 3

G R I D

C O N C E P T S H e a d e r M a i n A s i d e F o o t e r

Slide 4

Slide 4

G R I D

L I N E S H e a d e r M a i n A s i d e F o o t e r 1 2 3 1 2 3 4

Slide 5

Slide 5

G R I D

T R A C K S

Slide 6

Slide 6

G R I D

T R A C K S R O W S H e a d e r M a i n A s i d e F o o t e r

Slide 7

Slide 7

G R I D

T R A C K S C O L U M N S H e a d e r M a i n A s i d e F o o t e r

Slide 8

Slide 8

G R I D

C E L L S H e a d e r M a i n A s i d e F o o t e r

Slide 9

Slide 9

G R I D

A R E A S H e a d e r M a i n A s i d e F o o t e r

Slide 10

Slide 10

I M P L E M E N T A T I O N S T A T U S

Slide 11

Slide 11

G R I D

C O N T A I N E R S P r o p e r t y :

d i s p l a y V a l u e s S t a t u s g r i d D O N E i n l i n e

g r i d D O N E s u b g r i d T O D O

( a t

r i s k )

6 1 8 9 6 9

Slide 12

Slide 12

G R I D

I T E M S P r o p e r t i e s S t a t u s o r d e r D O N E z

i n d e x D O N E m i n

s i z e :

a u t o D O N E

Slide 13

Slide 13

E X P L I C I T

G R I D

( I ) P r o p e r t i e s :

g r i d

t e m p l a t e

c o l u m n s | r o w s V a l u e s S t a t u s a u t o ,

l e n g t h ,

p e r c e n t a g e D O N E f l e x

( f r

u n i t ) D O N E m i n

c o n t e t ,

m a x

c o n t e n t D O N E m i n m a x ( ) D O N E f i t

c o n t e n t ( ) T O D O

6 1 8 9 7 2

Slide 14

Slide 14

E X P L I C I T

G R I D

( I )

E X A M P L E A B C D . g r i d

{

d i s p l a y :

g r i d ;

g r i d

t e m p l a t e

c o l u m n s :

;

g r i d

t e m p l a t e

r o w s :

;

} < d i v   c l a s s

" g r i d "

        < d i v   c l a s s

" a "

A < / d i v

        < d i v   c l a s s

" b "

B < / d i v

        < d i v   c l a s s

" c "

C < / d i v

        < d i v   c l a s s

" d "

D < / d i v

< / d i v

Slide 15

Slide 15

E X P L I C I T

G R I D

( I I ) P r o p e r t i e s :

g r i d

t e m p l a t e

c o l u m n s | r o w s V a l u e s / F e a t u r e s S t a t u s r e p e a t ( i n t e g e r ,

) D O N E r e p e a t ( a u t o

f i l l ,

) D O N E r e p e a t ( a u t o

f i t ,

) W I P

M u l t i p l e

t r a c k s T O D O

5 8 9 4 6 0

6 1 9 9 3 0

Slide 16

Slide 16

E X P L I C I T

G R I D

( I I )

E X A M P L E A B C D E F . g r i d

{

d i s p l a y :

g r i d ;

g r i d

t e m p l a t e

c o l u m n s :

r e p e a t ( 3 ,

1 0 0 p x )

;

g r i d

t e m p l a t e

r o w s :

r e p e a t ( 2 ,

1 0 0 p x )

;

} < d i v   c l a s s

" g r i d "

        < d i v   c l a s s

" a "

A < / d i v

        < d i v   c l a s s

" b "

B < / d i v

        < d i v   c l a s s

" c "

C < / d i v

        < d i v   c l a s s

" d "

D < / d i v

        < d i v   c l a s s

" e "

E < / d i v

        < d i v   c l a s s

" f "

F < / d i v

< / d i v

Slide 17

Slide 17

E X P L I C I T

G R I D

( I I I ) P r o p e r t i e s S t a t u s g r i d

t e m p l a t e

a r e a s D O N E g r i d

t e m p l a t e

s h o r t h a n d D O N E

Slide 18

Slide 18

E X P L I C I T

G R I D

( I I I )

E X A M P L E A B C D . g r i d

{

d i s p l a y :

g r i d ;

g r i d

a u t o

c o l u m n s :

1 0 0 p x ;

g r i d

a u t o

r o w s :

7 5 p x ;

g r i d

t e m p l a t e

a r e a s :

" h e a d

h e a d "

" n a v

m a i n "

" f o o t

f o o t " ;

} . a

{

g r i d

a r e a :

h e a d ;

} . b

{

g r i d

a r e a :

m a i n ;

} . c

{

g r i d

a r e a :

n a v ;

} . d

{

g r i d

a r e a :

f o o t ;

} < d i v   c l a s s

" g r i d "

        < d i v   c l a s s

" a "

A < / d i v

        < d i v   c l a s s

" b "

B < / d i v

        < d i v   c l a s s

" c "

C < / d i v

        < d i v   c l a s s

" d "

D < / d i v

< / d i v

Slide 19

Slide 19

I M P L I C I T

G R I D

( I ) P r o p e r t i e s S t a t u s g r i d

a u t o

c o l u m n s | r o w s D O N E g r i d

a u t o

c o l u m n s | r o w s

m u l t i p l e t r a c k s T O D O

6 1 8 9 7 0

Slide 20

Slide 20

I M P L I C I T

G R I D

( I I ) P r o p e r t i e s S t a t u s g r i d

a u t o

f l o w D O N E g r i d

s h o r t h a n d D O N E g r i d

s h o r t h a n d

n e w

s y n t a x T O D O

6 1 8 9 7 1

Slide 21

Slide 21

P L A C I N G

G R I D

I T E M S

( I ) P r o p e r t i e s :

g r i d

c o l u m n | r o w

s t a r t | e n d V a l u e s S t a t u s a u t o D O N E l i n e

n a m e D O N E s p a n D O N E

Slide 22

Slide 22

P L A C I N G

G R I D

I T E M S

( I I ) P r o p e r t i e s / F e a t u r e s S t a t u s g r i d

c o l u m n | r o w s

s h o r t h a n d s D O N E g r i d

a r e a

s h o r t h a n d D O N E P l a c e m e n t

a l g o r i t h m D O N E

Slide 23

Slide 23

P L A C I N G

G R I D

I T E M S

E X A M P L E A B C . g r i d

{

d i s p l a y :

g r i d ;

g r i d :

1 0 0 p x

1 0 0 p x

/

2 0 0 p x

2 0 0 p x ;

} . a

{

} < d i v   c l a s s

" g r i d "

        < d i v   c l a s s

" a "

A < / d i v

        < d i v   c l a s s

" b "

B < / d i v

        < d i v   c l a s s

" c "

C < / d i v

< / d i v

Slide 24

Slide 24

A B S O L U T E

P O S I T I O N I N G F e a t u r e s S t a t u s P l a c e m e n t D O N E A l i g n m e n t T O D O

6 0 3 4 2 3

Slide 25

Slide 25

A B S O L U T E

P O S I T I O N I N G

E X A M P L E 0 1 2 4

0 0 1 2 3

0 p o s i t i o n :

a b s o l u t e ; g r i d

c o l u m n :

1

/

a u t o ; g r i d

r o w :

2

/

a u t o ; t o p :

8 0 p x ; b o t t o m :

6 0 p x ; l e f t : 9 0 p x ; r i g h t : 7 0 p x ;

Slide 26

Slide 26

G U T T E R S P r o p e r t i e s / V a l u e s S t a t u s g r i d

c o l u m n | r o w

g a p

l e n g t h D O N E g r i d

c o l u m n | r o w

g a p p e r c e n t a g e W I P

( a t

r i s k )

g r i d

g a p

s h o r t h a n d D O N E

6 1 5 2 4 8

Slide 27

Slide 27

G U T T E R S

E X A M P L E A B C D E . g r i d

{

d i s p l a y :

g r i d ;

g r i d :

1 0 0 p x

1 0 0 p x

/

1 0 0 p x

1 0 0 p x

1 0 0 p x ;

g r i d

r o w

g a p :

;

g r i d

c o l u m n

g a p :

;

} < d i v   c l a s s

" g r i d "

        < d i v   c l a s s

" a "

A < / d i v

        < d i v   c l a s s

" b "

B < / d i v

        < d i v   c l a s s

" c "

C < / d i v

        < d i v   c l a s s

" d "

D < / d i v

        < d i v   c l a s s

" e "

E < / d i v

< / d i v

Slide 28

Slide 28

A L I G N M E N T

( I ) P r o p e r t i e s S t a t u s a u t o

m a r g i n s D O N E j u s t i f y | a l i g n

s e l f D O N E j u s t i f y | a l i g n

i t e m s D O N E j u s t i f y | a l i g n

c o n t e n t D O N E

Slide 29

Slide 29

A L I G N M E N T

( I )

E X A M P L E

( I ) A B C . g r i d

{

d i s p l a y :

g r i d ;

g r i d :

1 0 0 p x

1 0 0 p x

/

2 0 0 p x

2 0 0 p x ;

a l i g n

i t e m s :

;

j u s t i f y

i t e m s :

;

} . b

{

a l i g n

s e l f :

;

j u s t i f y

s e l f :

;

} < d i v   c l a s s

" g r i d "

        < d i v   c l a s s

" a "

A < / d i v

        < d i v   c l a s s

" b "

B < / d i v

        < d i v   c l a s s

" c "

C < / d i v

< / d i v

Slide 30

Slide 30

A L I G N M E N T

( I )

E X A M P L E

( I I ) A B C . g r i d

{

d i s p l a y :

g r i d ;

g r i d :

1 0 0 p x

1 0 0 p x

/

1 5 0 p x

1 5 0 p x ;

a l i g n

c o n t e n t :

;

j u s t i f y

c o n t e n t :

;

} < d i v   c l a s s

" g r i d "

        < d i v   c l a s s

" a "

A < / d i v

        < d i v   c l a s s

" b "

B < / d i v

        < d i v   c l a s s

" c "

C < / d i v

< / d i v

Slide 31

Slide 31

A L I G N M E N T

( I I ) F e a t u r e s S t a t u s n o r m a l

v a l u e W I P

O v e r f l o w

a l i g n m e n t D O N E B a s e l i n e

a l i g n m e n t W I P

5 6 5 8 8 3

4 1 2 4 1 0

Slide 32

Slide 32

G R I D

S I Z I N G F e a t u r e s S t a t u s T r a c k

s i z i n g

a l g o r i t h m D O N E O r t h o g o n a l

f l o w s

s u p p o r t W I P

4 4 5 7 4 2

Slide 33

Slide 33

F R A G M E N T A T I O N F e a t u r e s S t a t u s F r a g m e n t a t i o n

a l g o r i t h m T O D O

6 1 4 6 6 7

Slide 34

Slide 34

S U B G R I D S

Slide 35

Slide 35

S U B G R I D S N e s t e d

G r i d A B C D E S 1 S u b 2 S 3 S u b 4 S u b g r i d A B C D E S u b 1 S u b 2 S u b 3 S u b 4

Slide 36

Slide 36

R E D U C E D

P R O P O S A L D I S P L A Y :

S U B G R I D ; T r a c k

s i z i n g

d e f i n i t i o n

f r o m

t h e

p a r e n t

g r i d ( n o

g r i d

t e m p l a t e

c o l u m n s | r o w s ) S u b g r i d s

h a v e

n o

i m p l i c i t

g r i d ( n o

g r i d

a u t o

c o l u m n s | r o w s ) g r i d

t e m p l a t e

a r e a

c a n

b e

u s e d

w i t h i n

t h e

s u b g r i d

Slide 37

Slide 37

S U B G R I D S

E X A M P L E I n p u t C h e c k b o x S u b m i t   f o r m u l

{

d i s p l a y :

g r i d ;

} l i

{

d i s p l a y :

g r i d ;

} l a b e l

{

g r i d

c o l u m n :

1 ;

} < f o r m

< u l

        < l i

< l a b e l

I n p u t < / l a b e l

< i n p u t

< / l i

        < l i

< l a b e l

C h e c k b o x < / l a b e l

< i n p u t   t y p e         < l i

< b u t t o n

S u b m i t   f o r m < / b u t t o n

< / l i < / u l

< / f o r m

Slide 38

Slide 38

P E R F O R M A N C E O p t i m i z a t i o n s

t o

a v o i d

r e

l a y o u t

i n

s o m e

s i t u a t i o n s

Slide 39

Slide 39

W 3 C

T E S T

S U I T E C o m p l e t e

t h e

t e s t

s u i t e C u r r e n t l y

( m o s t

u n r e v i e w e d ) 1 1 7

t e s t s I m p o r t

t e s t

s u i t e

o n c e

i t ' s

r e a d y

Slide 40

Slide 40

C H R O M E

D E V T O O L S A d d

g r i d

l a y o u t

s u p p o r t I d e a s :

s h o w

g r i d

l i n e s ,

h i g h l i g h t

i t e m ' s

g r i d

a r e a ,

e t c .

Slide 41

Slide 41

D I S P L A Y :

C O N T E N T S ; A v o i d

b o x

g e n e r a t i o n U s e f u l

f o r

o t h e r

t h i n g s

( n o t

o n l y

G r i d

L a y o u t ) A l r e a d y

s u p p o r t e d

o n

F i r e f o x

Slide 42

Slide 42

S P E C

S T A T U S

Slide 43

Slide 43

W 3 C

S P E C I F I C A T I O N C S S

G r i d

L a y o u t

h t t p s : / / d r a � s . c s s w g . o r g / c s s

g r i d / S t a r t e d

b y

M i c r o s o �

i n

2 0 1 0 L a s t

W o r k i n g

D r a �

1 9

M a y

2 0 1 6 W 3 C

T e s t

S u i t e

Slide 44

Slide 44

C A N

I

U S E

G R I D ?

Slide 45

Slide 45

B R O W S E R S

A D O P T I O N

ὠ O l d i m p l e m e n t a t i o n s i n c e

I E

1 0 P r e f i x e d :

m s G e t t i n g

r e a d y ⚐ E x p e r i m e n t a l

W e b

P l a t f o r m F e a t u r e s V e r y

c l o s e

t o C h r o m e E n a b l e d

b y

d e f a u l t

o n

S a f a r i T e c h n o l o g y

P r e v i e w G e t t i n g

r e a d y

t o o ⚐ l a y o u t . c s s . g r i d . e n a b l e d P o l y f i l l :

h t t p s : / / g i t h u b . c o m / F r e m y C o m p a n y / c s s

g r i d

p o l y f i l l

Slide 46

Slide 46

E X A M P L E S

b y

I g a l i a

b y

R a c h e l

A n d r e w h t t p : / / i g a l i a . g i t h u b . i o / c s s

g r i d

l a y o u t / h t t p : / / g r i d b y e x a m p l e . c o m /

Slide 47

Slide 47

A C K N O W L E D G E M E N T S

a n d

w o r k i n g

t o g e t h e r

t o

b u i l d

a

b e t t e r

w e b I g a l i a B l o o m b e r g

Slide 48

Slide 48

©

W a l d e m a r

M e r g e r

h t t p s : / / w w w . f l i c k r . c o m / p h o t o s / p a x x / 5 0 6 4 7 6 8 5 2 8 / T H A N K

Y O U ! T w i t t e r :

M a i l :

B l o g :

@ r e g o c a s r e g o @ i g a l i a . c o m h t t p : / / b l o g s . i g a l i a . c o m / m r e g o /