layout-views-grid-horizontal.pcss.css

Responsive styles for views grid horizontal layout.

File

core/themes/olivero/css/layout/layout-views-grid-horizontal.pcss.css

View source
  1. /**
  2. * @file
  3. * Responsive styles for views grid horizontal layout.
  4. */
  5. @import "../base/variables.pcss.css";
  6. :root {
  7. --views-grid-layout-gap: var(--sp);
  8. }
  9. .views-view-grid--horizontal {
  10. display: flex;
  11. flex-wrap: wrap;
  12. &.cols-1 {
  13. & > * {
  14. flex-basis: 100%;
  15. margin-inline-end: 0;
  16. }
  17. }
  18. &.cols-2 {
  19. & > * {
  20. flex-basis: 100%;
  21. margin-inline-end: 0;
  22. /* 2 column layout. */
  23. @media (--md) {
  24. flex-basis: calc(100% / 2 - (((2 - 1) / 2) * var(--views-grid-layout-gap)));
  25. margin-inline-end: var(--views-grid-layout-gap);
  26. &:nth-child(2n) {
  27. margin-inline-end: 0;
  28. }
  29. }
  30. }
  31. }
  32. &.cols-3 {
  33. & > * {
  34. flex-basis: 100%;
  35. margin-inline-end: 0;
  36. /* 2 column layout. */
  37. @media (--md) {
  38. flex-basis: calc(100% / 2 - (((2 - 1) / 2) * var(--views-grid-layout-gap)));
  39. margin-inline-end: var(--views-grid-layout-gap);
  40. &:nth-child(2n) {
  41. margin-inline-end: 0;
  42. }
  43. }
  44. /* 3 column layout. */
  45. @media (--lg) {
  46. flex-basis: calc(100% / 3 - (((3 - 1) / 3) * var(--views-grid-layout-gap)));
  47. &:nth-child(2n) {
  48. margin-inline-end: var(--views-grid-layout-gap);
  49. }
  50. &:nth-child(3n) {
  51. margin-inline-end: 0;
  52. }
  53. }
  54. }
  55. }
  56. &.cols-4 {
  57. & > * {
  58. flex-basis: 100%;
  59. margin-inline-end: 0;
  60. /* 2 column layout. */
  61. @media (--md) {
  62. flex-basis: calc(100% / 2 - (((2 - 1) / 2) * var(--views-grid-layout-gap)));
  63. margin-inline-end: var(--views-grid-layout-gap);
  64. &:nth-child(2n) {
  65. margin-inline-end: 0;
  66. }
  67. }
  68. /* 4 column layout. */
  69. @media (--lg) {
  70. flex-basis: calc(100% / 4 - (((4 - 1) / 4) * var(--views-grid-layout-gap)));
  71. &:nth-child(2n) {
  72. margin-inline-end: var(--views-grid-layout-gap);
  73. }
  74. &:nth-child(4n) {
  75. margin-inline-end: 0;
  76. }
  77. }
  78. }
  79. }
  80. &.cols-5 {
  81. & > * {
  82. flex-basis: 100%;
  83. margin-inline-end: 0;
  84. /* 2 column layout. */
  85. @media (--sm) {
  86. flex-basis: calc(100% / 2 - (((2 - 1) / 2) * var(--views-grid-layout-gap)));
  87. margin-inline-end: var(--views-grid-layout-gap);
  88. &:nth-child(2n) {
  89. margin-inline-end: 0;
  90. }
  91. }
  92. /* 3 column layout. */
  93. @media (--md) {
  94. flex-basis: calc(100% / 3 - (((3 - 1) / 3) * var(--views-grid-layout-gap)));
  95. &:nth-child(2n) {
  96. margin-inline-end: var(--views-grid-layout-gap);
  97. }
  98. &:nth-child(3n) {
  99. margin-inline-end: 0;
  100. }
  101. }
  102. /* 5 column layout. */
  103. @media (--lg) {
  104. flex-basis: calc(100% / 5 - (((5 - 1) / 5) * var(--views-grid-layout-gap)));
  105. &:nth-child(3n) {
  106. margin-inline-end: var(--views-grid-layout-gap);
  107. }
  108. &:nth-child(5n) {
  109. margin-inline-end: 0;
  110. }
  111. }
  112. }
  113. }
  114. &.cols-6 {
  115. & > * {
  116. flex-basis: 100%;
  117. margin-inline-end: 0;
  118. /* 2 column layout. */
  119. @media (--sm) {
  120. flex-basis: calc(100% / 2 - (((2 - 1) / 2) * var(--views-grid-layout-gap)));
  121. margin-inline-end: var(--views-grid-layout-gap);
  122. &:nth-child(2n) {
  123. margin-inline-end: 0;
  124. }
  125. }
  126. /* 3 column layout. */
  127. @media (--md) {
  128. flex-basis: calc(100% / 3 - (((3 - 1) / 3) * var(--views-grid-layout-gap)));
  129. &:nth-child(2n) {
  130. margin-inline-end: var(--views-grid-layout-gap);
  131. }
  132. &:nth-child(3n) {
  133. margin-inline-end: 0;
  134. }
  135. }
  136. /* 6 column layout. */
  137. @media (--lg) {
  138. flex-basis: calc(100% / 6 - (((6 - 1) / 6) * var(--views-grid-layout-gap)));
  139. &:nth-child(3n) {
  140. margin-inline-end: var(--views-grid-layout-gap);
  141. }
  142. &:nth-child(6n) {
  143. margin-inline-end: 0;
  144. }
  145. }
  146. }
  147. }
  148. &.cols-7 {
  149. & > * {
  150. flex-basis: 100%;
  151. margin-inline-end: 0;
  152. /* 2 column layout. */
  153. @media (--sm) {
  154. flex-basis: calc(100% / 2 - (((2 - 1) / 2) * var(--views-grid-layout-gap)));
  155. margin-inline-end: var(--views-grid-layout-gap);
  156. &:nth-child(2n) {
  157. margin-inline-end: 0;
  158. }
  159. }
  160. /* 3 column layout. */
  161. @media (--md) {
  162. flex-basis: calc(100% / 3 - (((3 - 1) / 3) * var(--views-grid-layout-gap)));
  163. &:nth-child(2n) {
  164. margin-inline-end: var(--views-grid-layout-gap);
  165. }
  166. &:nth-child(3n) {
  167. margin-inline-end: 0;
  168. }
  169. }
  170. /* 7 column layout. */
  171. @media (--lg) {
  172. flex-basis: calc(100% / 7 - (((7 - 1) / 7) * var(--views-grid-layout-gap)));
  173. &:nth-child(3n) {
  174. margin-inline-end: var(--views-grid-layout-gap);
  175. }
  176. &:nth-child(7n) {
  177. margin-inline-end: 0;
  178. }
  179. }
  180. }
  181. }
  182. &.cols-8 {
  183. & > * {
  184. flex-basis: 100%;
  185. margin-inline-end: 0;
  186. /* 2 column layout. */
  187. @media (--sm) {
  188. flex-basis: calc(100% / 2 - (((2 - 1) / 2) * var(--views-grid-layout-gap)));
  189. margin-inline-end: var(--views-grid-layout-gap);
  190. &:nth-child(2n) {
  191. margin-inline-end: 0;
  192. }
  193. }
  194. /* 4 column layout. */
  195. @media (--md) {
  196. flex-basis: calc(100% / 4 - (((4 - 1) / 4) * var(--views-grid-layout-gap)));
  197. &:nth-child(2n) {
  198. margin-inline-end: var(--views-grid-layout-gap);
  199. }
  200. &:nth-child(4n) {
  201. margin-inline-end: 0;
  202. }
  203. }
  204. /* 8 column layout. */
  205. @media (--lg) {
  206. flex-basis: calc(100% / 8 - (((8 - 1) / 8) * var(--views-grid-layout-gap)));
  207. &:nth-child(4n) {
  208. margin-inline-end: var(--views-grid-layout-gap);
  209. }
  210. &:nth-child(8n) {
  211. margin-inline-end: 0;
  212. }
  213. }
  214. }
  215. }
  216. & > * {
  217. flex-grow: 0;
  218. flex-shrink: 0;
  219. margin-block-end: var(--views-grid-layout-gap);
  220. }
  221. }

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.