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

Responsive Web Design and Embracing the Unknown

Aaron Weyenberg
November 09, 2011

Responsive Web Design and Embracing the Unknown

Design for the web is undergoing a dizzying disruption driven by the growing landscape of client devices. Responsive design, as a “response” to this disorder, began as a technique. It’s now maturing into a philosophy. In this session, Aaron will take you through the conditions that gave rise to RWD and the core mechanics of the responsive design approach. We’ll take an honest look at the headwinds that RWD is facing, and some emerging techniques and practices to counter those challenges.

Aaron Weyenberg

November 09, 2011
Tweet

More Decks by Aaron Weyenberg

Other Decks in Design

Transcript

  1. Now if you’re viewing the site on a telephone, you

    will never in a trillion years experience the site. You’ll think you have experienced it. But you’ll be cheated. It’s such a sadness that you think you’ve viewed a site on your... fffucking telephone. Get real. Wednesday, November 9, 11
  2. We should ... design for this flexibility. But first, we

    must ‘accept the ebb and flow of things’.” “ Wednesday, November 9, 11
  3. Using percentages to specify page layout in CSS automatically creates

    adaptive pages.” “ Wednesday, November 9, 11
  4. @media print { ... } <link rel=“stylesheet” href= “print.css” media=“print”>

    CSS2: Media Types External link Embedded Wednesday, November 9, 11
  5. @media only screen and (min-width:500px) { ... } <link rel=“stylesheet”

    href= “default.css” media=“only screen and (min-width:500px)”> CSS3: Media Conditions External link Embedded Wednesday, November 9, 11
  6. ...there is only The Web, which we view in different

    ways. There is also no Desktop Web. Or Tablet Web. Thank you.” Stephen Hay via Twitter “There is no mobile web... Wednesday, November 9, 11
  7. The RWD Stack Adaptive layouts & grids Flexible images &

    content CSS3 Media Queries Wednesday, November 9, 11
  8. Adaptive layouts .column1 { float: left; width: 75%; } .column2

    { float: left; width: 25%; } Wednesday, November 9, 11
  9. Adaptable layouts .column1 { float: left; width: 75%; } .column2

    { float: left; width: 25%; } Wednesday, November 9, 11
  10. Adaptable layouts .column1 { float: none; width: auto; } .column2

    { float: none; width: auto; } Wednesday, November 9, 11
  11. Desktop down MQ’s @media only screen and (max-width: 992px) {

    // up to 992px } // Resets // Global styles // Styles for all widths @media only screen and (max-width: 1382px) { // up to 1382px } Wednesday, November 9, 11
  12. @media only screen and (max-width: 600px) { // up to

    600px } @media only screen and (max-width: 768px) { // up to 768px } @media only screen and (max-width: 480px) { // up to 480px } Wednesday, November 9, 11
  13. Mobile up MQ’s @media only screen and (min-width: 600px) {

    // 600px and up } // Resets // Global styles // All styles for widths < 480px @media only screen and (min-width: 480px) { // 480px and up } No query IS your first query Wednesday, November 9, 11
  14. @media only screen and (min-width: 992px) { // 992px and

    up } @media only screen and (min-width: 768px) { // 768px and up } @media only screen and (min-width: 1382px) { // 1382px and up } Wednesday, November 9, 11
  15. Ranged MQ’s @media only screen and (min-width: 480px) and (max-width:

    600px) { // between 480px to 600px } for discrete styles 0 480px 600px 1382px Wednesday, November 9, 11
  16. 6HUYHUVLGHUHVSRQVLYH LPDJHV KWWSVJLWKXE FRPFDUVRQPFGRQDOG6HUYHU6LGH5HVSRQVLYH,PDJH([DPSOHUHDGPH QD <HV 1R <HV :85)/-DYD QD

    QD /LNHO\WRKDYH SUREOHPVEHFDXVH GLIIHUHQWVL]HLPDJHV FRPHIURPWKHVDPH XUO QD *3/Y $VIDUDV,FDQWHOOWKLVLVD:85)/EDVHGDOWHUQDWLYHWR7LQ\65& ,WLVDVHUYLFHWKDW\RXFDQFDOOZLWKDQLPDJHXUOWKDWZLOOUHVL]HWKH LPDJHEDVHGRQZKDW:85)/NQRZVDERXWWKHVL]HRIWKHGHYLFH 9HU\QHZSURMHFW&DUVRQ0F'RQDOGVWDUWHGLWZKLOHDW%UHDNLQJ 'HYHORSPHQWFRQIHUHQFHLQ6HSWHPEHU \ \ 6HQFKDLR6UF KWWSZZZVHQFKD FRPSURGXFWVLR :RUNV <HV 1R <HV :HEVHUYLFH QD QD 1RLVVXHV QD )UHH 2ULJLQDOO\FDOOHG7LQ\65&DQGEXLOWE\-DPHV3HDUFH8VHVGHYLFH GHWHFWLRQWRGHWHUPLQHVL]HRIGHYLFH2U\RXFDQSDVVVSHFLILF PHDVXUHPHQWVWKDW\R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¶WUHOHDVHGDUHFHQWYHUVLRQ7KHPDLQUHDVRQIRU LQFOXGLQJWKLVLVWKDWOLNHWKH%RVWRQ*OREHLWLVSUREDEO\WKHEHVW WKRXJKWRXWH[DPSOHGHDOLQJZLWKDORWHGJHFDVHVDQGSRWHQWLDO SLWIDOOV 7HFKQLTXH 85/ )LUVW/RDG 0XOWLSOH 6L]HV ([WUD 'RZQORDGV +DQGOH ,PDJH 5HVL]LQJ" 7HFK 1R&RRNLHV 1R-6 &DFKLQJDQG&'1V 1R0HGLD4XHU\ 6XSSRUW /LFHQVH 1RWHV GDWD QRVFULSW FRRNLHV EDVH KWDFFHVV XUO SDUDPHWHUV DVVXPHG ILOHVWUXFWXUH LPDJH VHUYLFH VHU VLG Wednesday, November 9, 11
  17. <noscript data-smallsrc=“small.jpg” data- largesrc=“big.jpg” class=“r”> <img src=“small.jpg” </noscript> 1. Get

    screen size with Javascript 2. Loop through <noscript> tags 3. Write in appropriate <img> tags <img src=“big.jpg” alt=“The big image” /> Wednesday, November 9, 11
  18. <img src=“http://src.sencha.io/http:// mysite.com/image.jpg” alt=“Magically resized image” /> 1. Prefix image

    url with proxy service Sencha.io 2. Nothing. YOur’e done. Wednesday, November 9, 11
  19. table, thead, tbody, th, td, tr { display: block; }

    thead tr { position: absolute; left: -9999px; } Stack all table elements Hide the table headers Wednesday, November 9, 11
  20. td { position: relative; padding-left: 50%; } td:before { position:

    absolute; width: 50%; content: attr(data-label); } Make space for data-labels Position and insert data-labels Wednesday, November 9, 11
  21. Is there a future for responsive ads? Yep. If we

    create one. (...like an independently responsive ad API.) Wednesday, November 9, 11
  22. What we’ll need to do Forget pixel precision Move to

    the browser early Rapid prototyping! Developers + Designers Wednesday, November 9, 11
  23. Photo: NASA, ESA, M. Livo and the Hubble 20th Anniversary

    Team (STScl) Wednesday, November 9, 11
  24. Taking the RWD path means Being at peace with the

    unknown Wednesday, November 9, 11