_vertical-margins.scss 3.5 KB

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