Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Exploring Flexbox with Chris Sauvé

755 views

Published on

Achieving complex layouts in CSS has had a very checkered history. We escaped the tyranny of tables, but what we got wasn't much better — floats have had to be co-opted into roles for which they were never designed, inline-blocks have that infuriating space between elements, and absolute positioning just doesn't belong in a world of responsive design. But, there may be hope: enter flexbox.

In this talk, we'll look at the basics of using flexbox, as well as working through a few traditionally-tricky layout problems that can be solved more easily with this set of properties. We'll also discuss about how flexbox is used at Shopify specifically, including the quirks we've run into. Finally, we'll get into why flexbox isn't a panacea, and how it might fit into a world with other layout techniques being used side-by-side.

---

About Chris Sauvé

Chris is a relative newcomer to the world of design and development. Three years ago, he became enamoured with the joy of solving complex programming problems and left his accounting career to pursue one in front-end development. Now, he spends his days working as a front-end developer at Shopify, and his nights playing board games, ultimate, and building on open-source projects both big and small (including bigfoot, a tool for building beautiful, responsive popovers for footnotes, and an as-yet-unreleased automated pattern library generator).

Published in: Internet
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m77EgH } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m77EgH } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Exploring Flexbox with Chris Sauvé

  1. 1. FLEXBOX
  2. 2. CHRIS SAUVE
  3. 3. LAYOUT STRATEGIES
  4. 4. TABLES
  5. 5. JUST DON’T.
  6. 6. ABSOLUTE POSITIONING
  7. 7. INLINE BLOCK
  8. 8. FLOATS
  9. 9. THINK DIFFERENT
  10. 10. CONTENT-OUT LAYOUT
  11. 11. parent child 1 child 2 child 3
  12. 12. 1 2 3
  13. 13. BROWSER SUPPORT
  14. 14. YES YES -­‐webkit YES10+ only -­‐ms  in  IE10 YES even  in  Mini!
  15. 15. YES YES -­‐webkit YES10+ only -­‐ms  in  IE10 YES even  in  Mini! CAN I USE SAYS… 92.12%
  16. 16. PARENT RULES
  17. 17. display:  flex;  //  or  inline-­‐flex flex-­‐direction:  row;  //  or  column
  18. 18. 1 2 3 flex-­‐direction:  row;
  19. 19. 1 2 3 flex-­‐direction:  column;
  20. 20. display:  flex;  //  or  inline-­‐flex flex-­‐direction:  row;  //  or  column
  21. 21. display:  flex;  //  or  inline-­‐flex flex-­‐direction:  row;  //  or  column align-­‐items:  stretch;
  22. 22. 1 2 3 Cross Axis align-­‐items
  23. 23. 1 2 3 align-­‐items:  stretch;  //  default
  24. 24. 1 2 3 align-­‐items:  center;
  25. 25. 1 2 3 align-­‐items:  flex-­‐start;
  26. 26. 1 2 3 align-­‐items:  flex-­‐end;
  27. 27. display:  flex;  //  or  inline-­‐flex flex-­‐direction:  row;  //  or  column align-­‐items:  stretch;
  28. 28. display:  flex;  //  or  inline-­‐flex flex-­‐direction:  row;  //  or  column align-­‐items:  stretch; justify-­‐content:  center;
  29. 29. 1 2 3 Main Axis justify-­‐content
  30. 30. 1 2 3 justify-­‐content:  center;
  31. 31. 1 2 3 justify-­‐content:  flex-­‐start;
  32. 32. 1 2 3 justify-­‐content:  flex-­‐end;
  33. 33. 1 2 3 justify-­‐content:  space-­‐between;
  34. 34. 1 2 3 justify-­‐content:  space-­‐around;
  35. 35. display:  flex;  //  or  inline-­‐flex flex-­‐direction:  row;  //  or  column align-­‐items:  stretch; justify-­‐content:  center;
  36. 36. display:  flex;  //  or  inline-­‐flex flex-­‐direction:  row;  //  or  column align-­‐items:  stretch; justify-­‐content:  center; flex-­‐wrap:  nowrap;
  37. 37. 1 2 3 flex-­‐wrap:  nowrap;
  38. 38. 1 2 3 flex-­‐wrap:  wrap;
  39. 39. CHILD RULES
  40. 40. flex-­‐grow:  0; flex-­‐shrink:  0; flex-­‐basis:  auto;
  41. 41. flex-­‐basis:  <number>; flex-­‐basis:  auto; width:  <number>; =
  42. 42. 1 2 3 100px 20px 20px 20px
  43. 43. 1 2 3 100px 20px 20px 20px 40px of “growth” available
  44. 44. 1 2 3 flex-­‐grow:  0; flex-­‐grow:  0; flex-­‐grow:  0;
  45. 45. 1 2 3 flex-­‐grow:  1; 13px of growth flex-­‐grow:  1; 13px of growth flex-­‐grow:  1; 13px of growth
  46. 46. 1 2 3 flex-­‐grow:  1; 10px of growth flex-­‐grow:  2; 20px of growth flex-­‐grow:  1; 10px of growth
  47. 47. 1 2 3 flex-­‐grow:  0; 0px of growth flex-­‐grow:  1; 20px of growth flex-­‐grow:  1; 20px of growth
  48. 48. 1 2 3 40px 20px 20px 20px
  49. 49. 1 2 3 40px 20px 20px 20px 20px of “shrink” available
  50. 50. flex-­‐shrink:  0; flex-­‐shrink:  0; flex-­‐shrink:  0; 1 2 3
  51. 51. flex-­‐shrink:  0; flex-­‐shrink:  1; flex-­‐shrink:  1; 1 0px of shrink 10px of shrink 10px of shrink
  52. 52. NO SILVER BULLET
  53. 53. FLEXBOX @SHOPIFY
  54. 54. GRID SYSTEM
  55. 55. .next-­‐grid  {      display:  flex;   } .next-­‐grid__cell  {      flex-­‐grow:  1;      flex-­‐shrink:  1;      flex-­‐basis:  0;   } .next-­‐grid__cell .next-­‐grid__cell .next-­‐grid
  56. 56. TABS
  57. 57. Scale proportionately Don’t scale Only fill space when there’s overflow
  58. 58. .next-­‐tab  {      flex-­‐grow:  1;      flex-­‐shrink:  1;      flex-­‐basis:  auto;   }.next-­‐tab__list-­‐-­‐has-­‐overflow  {      display:  flex;      align-­‐items:  stretch;   } .next-­‐tab__list-­‐-­‐has-­‐overflow .next-­‐tab .next-­‐tab .next-­‐tab .next-­‐tab .next-­‐tab-­‐-­‐disclosure .next-­‐tab-­‐-­‐disclosure  {      flex-­‐grow:  0;      flex-­‐shrink:  0;      flex-­‐basis:  auto;   }
  59. 59. POPOVERS
  60. 60. Max Height Scrollable, fill available space As small as possible, always visible
  61. 61. .next-­‐popover__pane  {      flex-­‐grow:  0;      flex-­‐shrink:  1;      flex-­‐basis:  auto;      overflow:  scroll;   } .next-­‐popover__content  {      display:  flex;      flex-­‐direction:  column;      align-­‐items:  stretch;   } .next-­‐popover__content .next-­‐popover__pane
  62. 62. .next-­‐popover__pane-­‐-­‐fixed  {      flex-­‐grow:  0;      flex-­‐shrink:  0;      flex-­‐basis:  auto;      overflow:  hidden;   } .next-­‐popover__content .next-­‐popover__pane .next-­‐popover__pane-­‐-­‐fixed
  63. 63. LIVE DEMOS
  64. 64. https://css-tricks.com/snippets/css/a-guide-to-flexbox/ CSS-TRICKS REFERENCE
  65. 65. FLEXBUGS https://github.com/philipwalton/flexbugs
  66. 66. THANKS EVERYONE!

×