Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CSS3: Layouts for the Multi-screen World

CSS3: Layouts for the Multi-screen World

A look at how the way we access the web has changed, and how CSS is evolving to meet new challenges. Given at Making Web conference #mwconf, Oslo, October 2013.

Peter Gasston

October 23, 2013
Tweet

More Decks by Peter Gasston

Other Decks in Technology

Transcript

  1. 3

  2. Use of mobile as first screen 0 13 25 38

    50 35+ 18-34 http://weve.com/mobile-eclipsing-tv-as-the-first-screen-for-consumers
  3. @media screen {…} @media screen and (min-width: 800px) {…} @media

    (orientation: portrait) {…} Media Queries
  4. Judging the capabilities of a device by the resolution of

    its screen is like judging the height of a person by the colour of their shoes.
  5. Future* Media Queries * Possibly @media (script: 0) {…} @media

    (hover: 1) {…} @media (pointer: coarse) {…} @media (luminosity: dim) {…}
  6. B A C B C A B C A The

    Three Stages of RWD
  7. Flexbox A B .a { flex: 2; } .b {

    flex: 1; } A B .parent { flex-direction: column; } .a { flex: 2; } .b { flex: 1; }
  8. Flexbox A B B C A .parent { flex-direction: column;

    } .a { order: 2; } .b { order: 1; }
  9. “Media queries can be used to do more than patch

    broken layouts: with proper planning, we can begin to choreograph content proportional to screen size, serving the best possible experience at any width.” http://trentwalton.com/2011/07/14/content-choreography/
  10. Flexbox .parent { align-items: center; justify-content: center; } A B

    .parent { flex-direction: column; } .a { flex: 1; } .b { flex: 0; }
  11. Grid Layout B .child { grid-column: 2; grid-row: 2; }

    .a { grid-column: 1 3; } .b { grid-area: 2 2 4 4; } A
  12. Grid Layout /* Grid A */ @media (min-width: 600px) {

    /* Grid B */ } @media (min-width: 1200px) { /* Grid C */ }
  13. Some of the CSS properties shown in this talk are

    experimental and subject to change. Check http://caniuse.com and http://html5please.com for latest implementation status. Peter Gasston @stopsatgreen