Top Banner
The Future State of Layout Stephen Hay . Fronteers, Amsterdam . 20091105
88

The Future State of Layout

Jan 27, 2015

Download

Technology

Stephen Hay

A presentation for the Fronteers 2009 Conference in Amsterdam on CSS3 layout.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: The Future State of Layout

The Future State of

LayoutStephen Hay . Fronteers, Amsterdam . 20091105

Page 2: The Future State of Layout

Stephen Hay

Creative Director,CinnamonDesigning for the Websince 1995

Page 3: The Future State of Layout

Stephen HayCreative Director,Cinnamon

Designing for the Websince 1995

Page 4: The Future State of Layout

Stephen HayCreative Director,CinnamonDesigning for the Websince 1995

Page 5: The Future State of Layout

CSS3

Page 6: The Future State of Layout

CSS3 is

Awesome.media queries, more selectors, font stuff, (...)!

Page 7: The Future State of Layout

Decorationbackgrounds, shadows, rounded corners, (...)

Page 8: The Future State of Layout

Many of these things are

trend-driven,decorative propertiesNeccessary, perhaps, but not as important as...

Page 9: The Future State of Layout

Type &Layout

Page 10: The Future State of Layout

Most frustration in web design &development stems from the lack of adecent layout mechanism.

Page 11: The Future State of Layout

Why is this important?

I True separation of presentation and structureI Source order independenceI Better data portability

Page 12: The Future State of Layout

Layout

Page 13: The Future State of Layout

hasNoLayout

Page 14: The Future State of Layout

Past

TablesGrid-like, but not a grid in the layout sense.

Page 15: The Future State of Layout
Page 16: The Future State of Layout

Present

Floats & PositioningCounter-intuitive andnot intended for layout on today’s Web.

Page 17: The Future State of Layout

Past and present

Serendipitous grids“Hey, cool! Everything lines up!”

Page 18: The Future State of Layout

Present

CSS FrameworksShouldn’t CSS be the framework?

Page 19: The Future State of Layout

What is gridlayout?

Page 20: The Future State of Layout

A grid is not a table

Page 21: The Future State of Layout

Photo courtesy of Kenn W. Kiser, morgueFile.com

Page 22: The Future State of Layout

Photo: beglib, morgueFile.com

Page 23: The Future State of Layout

Photo courtesy of Kenn W. Kiser, morgueFile.com

Page 24: The Future State of Layout
Page 25: The Future State of Layout

A grid is the underlyinggeometrical frameworkwhich defines the visualstructure of the canvas.

Page 26: The Future State of Layout

Two types of grids

Implicit gridsare created implicitly by theplacement of elements on a page.

Page 27: The Future State of Layout

Two types of grids

Explicit gridsare created explicitly, before theplacement of elements on a page.

Page 28: The Future State of Layout
Page 29: The Future State of Layout

Units vs Columns

Page 30: The Future State of Layout

The threeworking drafts

Page 31: The Future State of Layout

CSS3-Grid (Microsoft)CSS3-Flexbox (Mozilla)CSS3-Layout (W3C)

Page 32: The Future State of Layout

Grid Positioning Moduletakes a column- and row-based approach to creatingexplicit grids.

Page 33: The Future State of Layout

Grid Positioning: Properties

grid-columnsgrid-rows

Page 34: The Future State of Layout

Grid Positioning: Syntax

div {grid-columns: 69px (12px 69px)[11];grid-rows: 170px *;}

Page 35: The Future State of Layout

Grid Positioning

Page 36: The Future State of Layout

Grid Positioning: combined with multicolumn layout

div {grid-columns: 69px (12px 69px)[11];grid-rows: 170px *;columns: 3;column-gap: 12px;}

Page 37: The Future State of Layout

Grid Positioning: combined with multicolumn layout

Page 38: The Future State of Layout

Grid Positioning: Pros & Cons

Advantages DisadvantagesSimple syntax Reliance on other modules*-syntax (multilength) Somewhat restrictivegr unit Thinking is involvedExplicit grid No new placement mechanism

Page 39: The Future State of Layout

One cool thing about Grid Positioning Module

The gr unitA measurement unit to match your grid units!(Well, not exactly.)

Page 40: The Future State of Layout

Grid Positioning: the gr unit

blockquote.pullquote {float: top left column;float-offset: 1gr 4gr;width: 7gr;}

Page 41: The Future State of Layout

Grid Positioning: the gr unit

Page 42: The Future State of Layout

Cool! Can I try it out?

Nope.No known implementation at this time.

Page 43: The Future State of Layout

Flexible Box Modulecreates an implicit grid using flexible element stacking

Page 44: The Future State of Layout

“A CSS box modeloptimized forinterface design”A small part of XUL, ported to CSS.

Page 45: The Future State of Layout

Flexible Box: Properties

box-alignbox-directionbox-flexbox-flex-groupbox-linesbox-ordinal-groupbox-orientbox-pack

Page 46: The Future State of Layout

Flexible Box: Syntax

<div id="parent"><p id="child1">First child</p><p id="child2">Second child</p><p id="child3">Third child</p>

</div>

#parent {display: box;box-orient: horizontal;#child3 {

box-flex: 1;}

Page 47: The Future State of Layout
Page 48: The Future State of Layout

Flexible Box: Pros & Cons

Advantages DisadvantagesDeveloped for GUIs Implicit gridSimple syntax NestingSource order independent Lots of thinkingBrowser calculation

Page 49: The Future State of Layout

One cool thing about Flexible Box Module

The box-flex propertyFill available space, or don’t! Your choice!

Page 50: The Future State of Layout
Page 51: The Future State of Layout
Page 52: The Future State of Layout

Cool! Can I try it out?

Yes!In Firefox (use the -moz- prefix.)Works now and well (but in no other browsers)

Page 53: The Future State of Layout

Template Layout ModuleExplicit grids on adrenaline.

Page 54: The Future State of Layout

Basic site layouts are trivial to construct

Page 55: The Future State of Layout

Template Layout: New Stuff

I New values for the display propertyI New values for the position propertyI The ::slot() pseudo-elementI The gr unit

Page 56: The Future State of Layout

Template Layout: Syntax

<div id="header">Header</div><div id="content">Content</div><div id="nav">Navigation</div><div id="footer">Footer</div>

body {display: "a a a"

"b c c""d d d"; }

#header { position: a; }#nav { position: b; }#content { position: c; }#footer { position: d; }

Page 57: The Future State of Layout

Template Layout: Syntax

<div id="header">Header</div><div id="content">Content</div><div id="nav">Navigation</div><div id="footer">Footer</div>

body {display: "a a a" / 150px

"b c @" / *"d d d" / 80px200px * * ; }

#header { position: a; }#nav { position: b; }#content { position: c; }#footer { position: d; }

Page 58: The Future State of Layout

Template Layout: the ::slot() pseudo-element

::slot() allows youto style a slot,regardless of thecontent.body::slot(a) { background-color: silver; }

Page 59: The Future State of Layout

Template Layout with Multicolumn Layout

Page 60: The Future State of Layout

Template Layout with Multicolumn Layout

Page 61: The Future State of Layout

Template Layout: Pros & Cons

Advantages DisadvantagesSimple syntax Existing propertiesVisual, to-the-point Hard to implement(?)Explicit gridSource order independent

Page 62: The Future State of Layout

One cool thing about Template Layout Module

Speed and ease of use

Page 63: The Future State of Layout

Cool! Can I try it out?

Yes!Alexis Deveria’s jQuery implementation:http://code.google.com/p/css-template-layout/

Older implementations:

I http://transcendingcss.com/support/almcss.zipI http://www.terrainformatica.com/w3/flex-layout/flex-layout.htm

Page 64: The Future State of Layout

CSS3 Layout in action: Khoi Vinh’s Yeeaahh! Layout

Page 65: The Future State of Layout

CSS3 Layout in action: Basic Structure

Page 66: The Future State of Layout

CSS3 Layout in action: Basic Grid (1)

Page 67: The Future State of Layout

CSS3 Layout in action: Setting up the grid and slots

Page 68: The Future State of Layout

CSS3 Layout in action: Placing elements in the slots

Page 69: The Future State of Layout

CSS3 Layout in action: Basic Layout in place

Page 70: The Future State of Layout

CSS3 Layout in action: Laying out page components

Page 71: The Future State of Layout

You can nest templates,and depending on thecomponent, why notchoose the best layoutmechanism for the job?

Page 72: The Future State of Layout

CSS3 Layout in action: Component structure

Page 73: The Future State of Layout

CSS3 Layout in action: nesting boxes

Page 74: The Future State of Layout

CSS3 Layout in action: Adding more elements

Page 75: The Future State of Layout

CSS3 Layout in action: Laying out the boxes with flexbox

Page 76: The Future State of Layout

CSS3 Layout in action: Template playing nice with Flexbox

Page 77: The Future State of Layout

Remember these important points

I Source order is no longer an issueI You can still float and position (absolute on gr!)I There may be power in two modulesI Use media queries for alternative layouts!

Page 78: The Future State of Layout

Media queries and CSS3 Layout

div { display: "a a a""b c c""d d d"; }

becomes

div { display: "a""c""b""d"; }

Page 79: The Future State of Layout

What will the future bring?

Page 80: The Future State of Layout

I have no clue.

Page 81: The Future State of Layout

Give us some layout,dammit!We’re at the point that we don’t care which module it is.

(As long as it’s at least Template Layout. Thank you.)

Page 82: The Future State of Layout

Give us some layout,dammit!We’re at the point that we don’t care which module it is.(As long as it’s at least Template Layout. Thank you.)

Page 83: The Future State of Layout

There are huge advantages for designers and developers

CSS is the framework

MaintainabilityHow designers think

Page 84: The Future State of Layout

There are huge advantages for designers and developers

CSS is the frameworkMaintainability

How designers think

Page 85: The Future State of Layout

There are huge advantages for designers and developers

CSS is the frameworkMaintainabilityHow designers think

Page 86: The Future State of Layout

A solid layout mechanismwill change the faceof the Web.

Page 87: The Future State of Layout

Learn more or get involved

CSS3-layouthttp://www.w3.org/TR/css3-layout

CSS3-flexboxhttp://www.w3.org/TR/css3-flexbox

CSS3-gridhttp://www.w3.org/TR/css3-grid

CSS WG Mailing [email protected]

Page 88: The Future State of Layout

Thank you!This presentation is available at:the-haystack.com/presentations/fronteers09/

twitter.com/stephenhay

Special thanks to Bert Bos for his input, and to Khoi Vinh forallowing me to use his wonderful example.