the home of the future: css layouts

37
THE HOME OF THE FUTURE PETER GASSTON STOPSATGREEN broken-links.com

Upload: peter-gasston

Post on 27-Jan-2015

116 views

Category:

Technology


0 download

DESCRIPTION

Slides from my talk at Standards>Next, 28/05/11.

TRANSCRIPT

Page 1: The Home of the Future: CSS Layouts

THE HOME OF THE FUTURE

PETER GASSTONSTOPSATGREEN

broken-links.com

Page 2: The Home of the Future: CSS Layouts

Vernacular architecture

Page 3: The Home of the Future: CSS Layouts

POLiTE architecture

Page 4: The Home of the Future: CSS Layouts
Page 5: The Home of the Future: CSS Layouts
Page 6: The Home of the Future: CSS Layouts

Multi-columns

Page 7: The Home of the Future: CSS Layouts

Multi-columns

div { column-width: 10em; }div { column-count: 3; }

Page 8: The Home of the Future: CSS Layouts

Multi-columns

h2 { column-span: all; }

Page 9: The Home of the Future: CSS Layouts

multi-columns

Page 10: The Home of the Future: CSS Layouts

Multi-columns

PLUG 1 of 2

Page 11: The Home of the Future: CSS Layouts

Flex-box

Page 12: The Home of the Future: CSS Layouts

Flex-box

.holder { display: box; }

.child { box-flex: 1; }

A B.a { box-flex: 3; }

.b { box-flex: 2; }

Page 13: The Home of the Future: CSS Layouts

Flex-box

.child {box-flex: 0;box-align: center;box-pack: center;

}

.outer { box-orient: vertical; }

.a,.b { box-ordinal-group: 2; }

.c { box-ordinal-group: 1; }

C

A

B

Page 14: The Home of the Future: CSS Layouts

Flex-box

JS Shim: https://github.com/doctyper/flexie

Page 15: The Home of the Future: CSS Layouts

Flex-box

display: box → display: flexboxbox-flex → flex()box-orient → flex-directionbox-ordinal-group → flex-order

Spec: http://www.w3.org/TR/css3-flexbox/

Page 16: The Home of the Future: CSS Layouts

Template Layout

Page 17: The Home of the Future: CSS Layouts

TEMPLATE LAYOUT

.a { position: a; }

.b { position: b; }

.c { position: c; }

.outer { display: 'abc'; }

A

B

C

A B C

Page 18: The Home of the Future: CSS Layouts

TEMPLATE LAYOUT

.outer {display: 'abb' 'a.c';

}

A

B C

A

B

C

.outer {display: 'aa' 'bc';

}

Page 19: The Home of the Future: CSS Layouts

TEMPLATE LAYOUT

JS Shim: http://code.google.com/p/css-template-layout/Demos: http://nealgrosskopf.com/tech/thread.php?pid=46

Page 20: The Home of the Future: CSS Layouts

Grid Layout

Page 21: The Home of the Future: CSS Layouts

grid LAYOUT

div { display: grid; grid-columns: 1fr 1fr 2fr;}

div { display: grid; grid-columns: 1fr 1fr 2fr; grid-rows: 10em auto 40px;}

Page 22: The Home of the Future: CSS Layouts

grid LAYOUT

.child { grid-column: 2; grid-row: 2;}

.a { grid-column: 2; grid-column-span: 2;}.b { grid-row-span: 3; }

A

B

Page 23: The Home of the Future: CSS Layouts

grid LAYOUT

Spec: http://www.w3.org/TR/css3-grid-layout/Blog post: http://j.mp/kul0H1

http://blogs.msdn.com/b/ie/archive/2011/04/14/ie10-platform-preview-and-css-features-for-adaptive-layouts.aspx

Page 24: The Home of the Future: CSS Layouts

GRiD LAYOUT

.outer {grid-template: 'abc';

}.a { grid-cell: a; }.b { grid-cell: b; }.c { grid-cell: c; }

A B C

Page 25: The Home of the Future: CSS Layouts

Extended Floats

Page 26: The Home of the Future: CSS Layouts

EXTENDED FLOATS

.a {float: positioned;position: absolute;left: 33.3%;top: 33.33%;width: 33.3%;

}

Spec: http://www.interoperabilitybridges.com/css3-floats/

A

Page 27: The Home of the Future: CSS Layouts

Regions

Page 28: The Home of the Future: CSS Layouts

REGiONS: THREADS

A

B

.a { flow: 'foo'; }

.b { content: from(foo); }

B

C D

.b, .c, .d {content: from(foo);

}

Page 29: The Home of the Future: CSS Layouts

REGiONS: THREADS

Page 30: The Home of the Future: CSS Layouts

REGiONS: SHAPES

.child { wrap-shape: polygon(150px,0 0,300px 300px,300px); wrap-shape-mode: around;}

Page 31: The Home of the Future: CSS Layouts

REGiONS: SHAPES

Page 32: The Home of the Future: CSS Layouts

REGiONS: exclusions

.a { wrap-shape-mode: content; }

.b { wrap-shape: polygon(150px,0 0,300px 300px,300px); wrap-shape-mode: around;}

Page 33: The Home of the Future: CSS Layouts

REGiONS: EXCLUSIONS

Page 34: The Home of the Future: CSS Layouts

regions

Spec: http://dev.w3.org/csswg/css3-regions/Prototype: http://labs.adobe.com/technologies/cssregions/

Pro tip: use http://leo-koppelkamm.de/polyCreator/ forcreating polygons.

Page 35: The Home of the Future: CSS Layouts
Page 36: The Home of the Future: CSS Layouts

thanks. Buy my book!

nostarch.com/css3.htm

Page 37: The Home of the Future: CSS Layouts

http://brittbell.blogspot.com/

http://www.flickr.com/photos/banfflakelouise/2274619237/

http://www.flickr.com/photos/el_momento_i_sitio_apropiados/5634431702/

http://www.flickr.com/photos/chanc/3869133751/

http://www.flickr.com/photos/gullevek/580672409/

http://www.flickr.com/photos/instantjefferson/2231405/

http://www.flickr.com/photos/moritzbernoully/3412093432/

http://www.flickr.com/photos/paulaofessel/335809741/

http://www.flickr.com/photos/opacity/617608495/

IMAGE CREDITS