Advertisement
Guest User

Untitled

a guest
Aug 31st, 2015
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.21 KB | None | 0 0
  1. // * --------------------------------
  2. // * Sass 반복(Loop) 구문
  3. //
  4. // * 960.gs 그리드 시스템 모듈
  5. //
  6. // container
  7. // grid_[1, 2, 3, ..., n]
  8. // push_[1, 2, 3, ..., n]
  9. // pull_[1, 2, 3, ..., n]
  10. // prefix_[1, 2, 3, ..., n]
  11. // sufix_[1, 2, 3, ..., n]
  12. // alpha, first
  13. // omega, last
  14. // clearfix, clear
  15. //
  16. // * 설계 패턴(구현 공식)
  17. // 페이지 폭($page-width)
  18. // 컬럼 총 개수($total-columns)
  19. // 컬럼 사이 간격: 거터($gutter)
  20. //
  21. // 컬럼 한 개의 폭을 구하는 공식: (960 - ( (10 * 2) * 12 )) / 12
  22. // ($page-width - ( ($gutter * 2) * $total-columns ) ) / $total-columns
  23. // * --------------------------------
  24.  
  25.  
  26. // * --------------------------------
  27. // * 그리드 시스템 컬럼 계산 함수
  28. @function calc-columnWidth() {
  29. @return ($page-width - ( ($gutter * 2) * $total-columns ) ) / $total-columns;
  30. }
  31.  
  32. // * --------------------------------
  33. // * 그리드 시스템 제너레이터 환경변수
  34. $page-width: 960px !default; // 페이지 폭
  35. $total-columns: 12 !default; // 컬럼 총 개수
  36. $gutter: 10px !default; // 컬럼 사이 간격: 거터
  37. $column-width: calc-columnWidth();
  38. $grid-layout: center !default; // center, right
  39. $support-ie-6-7: false !default;
  40. // @debug $column-width;
  41.  
  42. // $grid-layout: right;
  43.  
  44. // * ------------------------------------
  45. // * Alpha(First), Omega(Last), Clearfix
  46. // * ------------------------------------
  47. .alpha, .first {
  48. margin-left: 0;
  49. }
  50.  
  51. .omega, .last {
  52. margin-right: 0;
  53. }
  54.  
  55. .clearfix {
  56. &::after {
  57. content: '';
  58. display: block;
  59. clear: both;
  60. }
  61. @if $support-ie-6-7 {
  62. .lt-ie8 & { zoom: 1; }
  63. }
  64. }
  65.  
  66. // * --------------------------------
  67. // * 그리드 시스템 Container 모듈
  68. // * --------------------------------
  69. .container {
  70. width: $page-width;
  71. @if $grid-layout == center {
  72. margin: 0 auto;
  73. }
  74. @if $grid-layout == right {
  75. margin-left: auto;
  76. }
  77.  
  78. // Clearfix
  79. @extend .clearfix;
  80. }
  81.  
  82.  
  83. // * --------------------------------
  84. // * 그리드 시스템 Column 모듈
  85. // * --------------------------------
  86. %grid-base {
  87. float: left;
  88. @if $support-ie-6-7 == true {
  89. display: inline;
  90. }
  91. margin: {
  92. left: $gutter;
  93. right: $gutter;
  94. }
  95. }
  96.  
  97. // * --------------------------------
  98. // * 그리드 시스템 Push & Pull 모듈
  99. // * --------------------------------
  100. %push-pull-base {
  101. position: relative;
  102. }
  103.  
  104. // * --------------------------------
  105. // * 그리드 시스템 생성 구문
  106. // * --------------------------------
  107. $i: 1;
  108. @while $i <= $total-columns {
  109. .grid_#{$i} {
  110. @extend %grid-base;
  111. // 컬럼 폭 x 컬럼 개수 + ( (거터 폭 x 2) x (컬럼 개수 - 1) )
  112. width: $column-width * $i + ( ($gutter * 2) * ($i - 1) );
  113. }
  114.  
  115. .push_#{$i} {
  116. @extend %push-pull-base;
  117. // 컬럼 폭 x 컬럼 개수 + ( (거터 폭 x 2) x 컬럼 개수 )
  118. left: $column-width * $i + ( ($gutter * 2) * $i );
  119. }
  120.  
  121. .pull_#{$i} {
  122. @extend %push-pull-base;
  123. // 컬럼 폭 x 컬럼 개수 + ( (거터 폭 x 2) x 컬럼 개수 )
  124. left: -1 * ($column-width * $i + ( ($gutter * 2) * $i ));
  125. }
  126.  
  127. .prefix_#{$i} {
  128. // 컬럼 폭 x 컬럼 개수 + ( (거터 폭 x 2) x 컬럼 개수 )
  129. padding-left: $column-width * $i + ( ($gutter * 2) * $i );
  130. }
  131.  
  132. .sufix_#{$i} {
  133. // 컬럼 폭 x 컬럼 개수 + ( (거터 폭 x 2) x 컬럼 개수 )
  134. padding-right: $column-width * $i + ( ($gutter * 2) * $i );
  135. }
  136.  
  137. $i: $i + 1;
  138. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement