Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2015
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. ### Mobile First Design
  2. - Responsive design flipped on its head
  3. - Start with smallest screen then build up
  4. - Starting w/ small screen forces you to focus on tough design decisions early on
  5. - When mobile is not a priority (big data, software, etc.) mobile first may not make much sense
  6. - Media queries build up, not down. For example:
  7.  
  8. ```css
  9. /* standard approach - builds down */
  10. .element {
  11. color: red;
  12. }
  13.  
  14. @media (max-width: 800px) {
  15. color: blue;
  16. }
  17.  
  18. @media (max-width: 400px) {
  19. color: black;
  20. }
  21.  
  22. /* mobile first approach - reversed - styling starts with mobile */
  23. /* moving up larger screens as code progresses */
  24. .element {
  25. color: black;
  26. }
  27.  
  28. @media (min-width: 800px) {
  29. color: blue;
  30. }
  31.  
  32. @media (min-width: 400px) {
  33. color: red;
  34. }
  35. ```
  36.  
  37. - Every component in Foundation is written mobile first. Clearest example is the grid:
  38.  
  39. ```html
  40. <!-- Classes like 'small-12' apply to that breakpoint and larger, in this case medium borrows from 'small-12' -->
  41. <div class="row">
  42. <div class="small-12 large-6 columns"></div>
  43. </div>
  44. ```
  45.  
  46. - Styling resets are easier to deal with in moobile first. As you define desktop styling and drill down to mobile, you'll have to override/reset styles for mobile (ex. changing sizes of buttons/columns for mobile and medium). Working from mobile up allows you to introduce complexity as you build up to larger sizes, reducing the amount of resets/overrides.
  47.  
  48. #### Editor Stuff
  49. - **Spaces v. Tabs** - Using two spaces as opposed to tabs is preferable because a space is always 1 character, whereas tabs can be ambiguous in width. Having two spaces as opposed to 4 is more easily readable as well.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement