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

Responsive Web Design in a Nutshell

Erik Frisk
September 05, 2013

Responsive Web Design in a Nutshell

Erik Frisk

September 05, 2013
Tweet

More Decks by Erik Frisk

Other Decks in Programming

Transcript

  1. Responsive vs. Adaptive Layout is fluid. Media queries are used

    to change the layout when it “breaks down”
  2. Responsive vs. Adaptive A set of pre-defined layout widths is

    used. No fluid layout. Layout is fluid. Media queries are used to change the layout when it “breaks down”
  3. 3 CSS Media Queries div.content { width: 1100px; margin: 0

    auto; } /* Large monitors */ @media screen and (min-width: 1600px) { div.content { width: 1440px; } } ... /* Tablets in portrait */ @media screen and (min-width: 761px) and (max-width: 990px) { div.content { width: 740px; } } /* Mobile */ @media screen and (max-width: 760px) { div.content { width: 100%; } }
  4. 4 Responsiveness in JavaScript // Detect screen size // ------------------

    if (window.innerWidth < 768) { // Do stuff specific to mobile } // ... or use enquire.js // --------------------- enquire.register("screen and (min-width:768px)", function() { // Load sidebar content in via AJAX. // Show sidebar });
  5. 1. http://trentwalton.com/ 2. http://www.bostonglobe.com/ 3. https://corporate.target.com/ 4. http://css-tricks.com/ 5. http://elliotjaystocks.com/

    6. http://www.leanmachine.se/ 7. http://www.awwwards.com/ 8. http://www.squarespace.com/stories 9. http://www.jessicahische.is/ 10. http://forefathersgroup.com/ 11. http://palantir.net/ 12. http://www.ampersandconf.com/