_vertical-margins.scss 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /**
  2. * Site Structure
  3. *
  4. * - Set vertical margins and responsive widths on
  5. * top-level wrappers and content wrappers
  6. * - `--global--width-content` is a responsive veriable
  7. * - See: globals/_global-width-responsive.scss
  8. */
  9. /**
  10. * Top Level Wrappers (header, main, footer)
  11. * - Set vertical padding and horizontal margins
  12. */
  13. .site-header,
  14. .site-main,
  15. .site-footer {
  16. padding: var(--global--spacing-unit) var(--global--spacing-horizontal);
  17. margin-left: auto;
  18. margin-right: auto;
  19. @include media(mobile) {
  20. padding-top: var(--global--spacing-vertical);
  21. padding-right: 0;
  22. padding-bottom: var(--global--spacing-vertical);
  23. padding-left: 0;
  24. }
  25. }
  26. .site-header {
  27. padding-top: calc(3 * var(--global--spacing-vertical));
  28. padding-bottom: calc(3 * var(--global--spacing-vertical));
  29. .has-main-navigation & {
  30. padding-top: calc(4 * var(--global--spacing-vertical));
  31. }
  32. @include media(mobile) {
  33. padding-top: calc(3 * var(--global--spacing-vertical));
  34. padding-bottom: calc(3 * var(--global--spacing-vertical));
  35. .has-main-navigation & {
  36. padding-top: calc(3 * var(--global--spacing-vertical));
  37. }
  38. }
  39. }
  40. /**
  41. * Site-main children wrappers
  42. * - Add double vertical margins here for clearer heirarchy
  43. */
  44. .site-main > * {
  45. margin-top: calc(3 * var(--global--spacing-vertical));
  46. margin-bottom: calc(3 * var(--global--spacing-vertical));
  47. &:first-child {
  48. margin-top: 0;
  49. }
  50. &:last-child {
  51. margin-bottom: 0;
  52. }
  53. }
  54. /**
  55. * Set the default maximum responsive content-width
  56. */
  57. .default-max-width {
  58. @extend %responsive-aligndefault-width;
  59. }
  60. /**
  61. * Set the wide maximum responsive content-width
  62. */
  63. .wide-max-width {
  64. @extend %responsive-alignwide-width;
  65. }
  66. /**
  67. * Set the full maximum responsive content-width
  68. */
  69. .full-max-width {
  70. @extend %responsive-alignfull-width-mobile;
  71. @extend %responsive-alignfull-width;
  72. }
  73. /*
  74. * Block & non-gutenberg content wrappers
  75. * - Set margins
  76. */
  77. .entry-header,
  78. .post-thumbnail,
  79. .entry-content,
  80. .entry-footer,
  81. .author-bio,
  82. .widget-area {
  83. margin-top: var(--global--spacing-vertical);
  84. margin-right: auto;
  85. margin-bottom: var(--global--spacing-vertical);
  86. margin-left: auto;
  87. }
  88. /*
  89. * Block & non-gutenberg content wrapper children
  90. * - Sets spacing-vertical margin logic
  91. */
  92. .site-footer > *,
  93. .site-main > article > *, // apply vertical margins to article level
  94. .site-main > .not-found > *, // apply vertical margins to article level
  95. .entry-content > *,
  96. [class*="inner-container"] > *,
  97. .widget-area > *,
  98. .widget-column > * {
  99. margin-top: calc( 0.666 * var(--global--spacing-vertical) );
  100. margin-bottom: calc( 0.666 * var(--global--spacing-vertical) );
  101. @include media(mobile) {
  102. margin-top: var(--global--spacing-vertical);
  103. margin-bottom: var(--global--spacing-vertical);
  104. }
  105. &:first-child {
  106. margin-top: 0;
  107. }
  108. &:last-child {
  109. margin-bottom: 0;
  110. }
  111. }
  112. /*
  113. * Block & non-gutenberg content wrapper children
  114. * - Sets spacing-unit margins
  115. */
  116. .site-header > *,
  117. .entry-header > *,
  118. .post-thumbnail > *,
  119. .page-content > *,
  120. .comment-content > *,
  121. .author-bio > *,
  122. .widget > * {
  123. margin-top: var(--global--spacing-unit);
  124. margin-bottom: var(--global--spacing-unit);
  125. &:first-child {
  126. margin-top: 0;
  127. }
  128. &:last-child {
  129. margin-bottom: 0;
  130. }
  131. }
  132. /*
  133. * .entry-content children specific controls
  134. * - Adds special margin overrides for alignment utility classes
  135. */
  136. .entry-content > * {
  137. &.alignleft,
  138. &.alignright,
  139. &.alignleft:first-child + *,
  140. &.alignright:first-child + *,
  141. &.alignfull {
  142. margin-top: 0;
  143. }
  144. &:last-child,
  145. &.alignfull {
  146. margin-bottom: 0;
  147. }
  148. /* Reset alignleft and alignright margins after alignfull */
  149. &.alignfull + .alignleft,
  150. &.alignfull + .alignright {
  151. margin-top: var(--global--spacing-vertical);
  152. }
  153. }