_grid.sass 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // *************************************
  2. //
  3. // Grid
  4. // -> Based on the following:
  5. // * https://github.com/necolas/suit-grid
  6. // * https://github.com/csswizardry/csswizardry-grids
  7. //
  8. // -------------------------------------
  9. // Template (Haml)
  10. // -------------------------------------
  11. //
  12. // .g
  13. // .grid-box[.grid-box-center|1of2|1of3|...]
  14. // .grid-box[.grid-box-center|1of2|1of3|...]
  15. // .grid-box[.grid-box-center|1of2|1of3|...]
  16. // .grid-box[.grid-box-center|1of2|1of3|...]
  17. //
  18. // *************************************
  19. // -------------------------------------
  20. // Base
  21. // -------------------------------------
  22. #{$g-selector}grid
  23. @extend %group
  24. display: block
  25. margin-left: -$g-gutter / 2
  26. margin-right: -$g-gutter / 2
  27. #{$g-selector}grid-box
  28. -moz-box-sizing: border-box
  29. box-sizing: border-box
  30. float: left
  31. margin: 0
  32. padding-left: $g-gutter / 2
  33. padding-right: $g-gutter / 2
  34. width: 100%
  35. // -------------------------------------
  36. // Modifiers
  37. // -------------------------------------
  38. // ----- Center ----- //
  39. #{$g-selector}grid-box-center
  40. display: block
  41. float: none
  42. margin: 0 auto
  43. // -------------------------------------
  44. // Setup
  45. // -------------------------------------
  46. =device-type($namespace: '')
  47. // ----- One Part ----- //
  48. #{$g-selector}grid-box-#{$namespace}1of1
  49. width: 100%
  50. // ----- Two Parts ----- //
  51. #{$g-selector}grid-box-#{$namespace}1of2
  52. width: 50%
  53. // ----- Three Parts ----- //
  54. @if $g-columns >= 3
  55. #{$g-selector}grid-box-#{$namespace}1of3
  56. width: 33.333%
  57. #{$g-selector}grid-box-#{$namespace}2of3
  58. width: 66.666%
  59. // ----- Four Parts ----- //
  60. @if $g-columns >= 4
  61. #{$g-selector}grid-box-#{$namespace}1of4
  62. width: 25%
  63. #{$g-selector}grid-box-#{$namespace}2of4
  64. @extend #{$g-selector}grid-box-#{$namespace}1of2
  65. #{$g-selector}grid-box-#{$namespace}3of4
  66. width: 75%
  67. // -------------------------------------
  68. // Creation
  69. // -------------------------------------
  70. +device-type()
  71. @each $device in $g-defaults
  72. @media screen and (min-width: nth($device, 2))
  73. +device-type("#{nth($device, 1)}--")