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

Responsive Web Design, oh my Glob!

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on. →

Responsive Web Design, oh my Glob!

Hopefully I'll update it later with some very useful links.

Avatar for Lucifero Von Nachtosphere

Lucifero Von Nachtosphere

September 11, 2014

Other Decks in Programming

Transcript

  1. Responsive Web Design is a combination of technologies and strategies

    aimed at creating Websites and Web-apps providing an optimal viewing experience across the entire spectrum of digital devices. ! Partially a philosophy that ultimately boils down to a collection of Web best practices. What’s RWD then?
  2. • CSS Media Queries • Fluid Grids • Responsive images

    • RESS (responsive design with server-side components) RWD—The Technologies (some of them)
  3. Max-width .sidebar { float: left; width: 30%; } /* adapt

    to tablet resolution */ @media (max-width: 50em) { /* 800px */ .sidebar { float: none; /* e.g.: push the sidebar down */ width: auto; } }
  4. Min-width .sidebar { /* nothing to put in here! */

    } /* adapt from tablet resolution */ @media (mix-width: 50.0625em) { /* 801px */ /* e.g.: show sidebar on the right */ .sidebar { float: right; width: 30%; } }
  5. Note: DPPX is Dots Per "px" unit Resolution .icon {

    /* load normal assets here */ } ! @media (min-resolution: 2dppx) { .icon { /* load higher resolution assets here */ } }
  6. Fluid Grids .column { /* your rules for a grid

    [float|inline-block|flexbox] */ } ! .column-one { width: 8.33334%; /* 1/12 units */ }
  7. Fluid Grids and Media Queries <div class=“column small-6 medium-3“>...</div> !

    /* small viewport */ .small-6 { width: 50%; /* 1/12 units */ } ! /* medium viewport */ @media (min-width: 40.0625em) { /* 641px */ .medium-3 { width: 25%; /* 3/12 units */ } }
  8. Width-less elements /* small viewport */ .wrapper { max-width: 60rem;

    /* 960px */ padding: 0 1rem; } ! /* medium viewport */ @media (min-width: 40.0625em) { /* 641px */ .wrapper { padding: 0 2.5rem; } }
  9. Compress and optimize Your BEAUTIFUL image as a jpeg !

    ! A. Poor compression, big image size 1300x1714px 230KB ! B. Fine compression, smaller image size 800x1055px 100KB ! 130KB difference
  10. <picture> element to the rescue <script src="picturefill.js"></script> <!-- polyfiller -->

    ! <picture> <source srcset="large.jpg" media="(min-width: 801px)”> <source srcset="medium.jpeg, [email protected] 2x" media="(max- width: 800px)"> <img srcset="small.jpg" alt="..."> </picture>
  11. • iOS Simulator • Android Emulator • Device inspection •

    Chrome Emulate feature Testing & Debugging Apps
  12. <script src="modernizr.js"></script> <!-- modernizr --> ! if(Modernizr.cssanimations) { // browser

    supports CSS3 Animations doAmazingThings(); } Feature detection with Modernizr
  13. var viewportLarge = window.matchMedia('(min-width: 801px)'); ! if(viewportLarge.matches) { // load

    a custom template, do some DOM trickery, etc... doOtherAmazingThings(); } window.matchMedia();