card-list.pcss.css

Same filename in other branches
  1. 9 core/themes/claro/css/layout/card-list.pcss.css
  2. 8.9.x core/themes/claro/css/layout/card-list.pcss.css
  3. 11.x core/themes/claro/css/layout/card-list.pcss.css

Cards list.

File

core/themes/claro/css/layout/card-list.pcss.css

View source
  1. /**
  2. * @file
  3. * Cards list.
  4. */
  5. :root {
  6. --card-list-spacing: var(--space-m);
  7. --cards-two-cols-width: calc(((100% + var(--card-list-spacing)) / 2) - var(--card-list-spacing));
  8. --cards-three-cols-width: calc(((100% + var(--card-list-spacing)) / 3) - var(--card-list-spacing));
  9. --cards-four-cols-width: calc(((100% + var(--card-list-spacing)) / 4) - var(--card-list-spacing));
  10. }
  11. .card-list {
  12. display: flex;
  13. flex-direction: column;
  14. }
  15. .card-list--two-cols,
  16. .card-list--four-cols {
  17. flex-direction: row;
  18. flex-wrap: wrap;
  19. align-items: stretch;
  20. justify-content: flex-start;
  21. }
  22. .card-list__item {
  23. box-sizing: border-box;
  24. margin-bottom: var(--card-list-spacing);
  25. }
  26. .card-list--two-cols .card-list__item,
  27. .card-list--four-cols .card-list__item {
  28. flex-basis: 100%;
  29. }
  30. /* 36.75rem theme screenshot width */
  31. @media screen and (min-width: 36.75rem) {
  32. .card-list--four-cols .card-list__item {
  33. flex-basis: var(--cards-two-cols-width);
  34. max-width: var(--cards-two-cols-width);
  35. }
  36. .card-list--four-cols .card-list__item {
  37. margin-right: var(--card-list-spacing);
  38. }
  39. [dir="rtl"] .card-list--four-cols .card-list__item {
  40. margin-right: 0;
  41. margin-left: var(--card-list-spacing);
  42. }
  43. .card-list--four-cols .card-list__item:nth-child(even) {
  44. margin-right: 0;
  45. }
  46. [dir="rtl"] .card-list--four-cols .card-list__item:nth-child(even) {
  47. margin-right: 0;
  48. margin-left: 0;
  49. }
  50. }
  51. /* 53.75rem it is width of screenshot image + toolbar width(15rem) + 2rem of margins. */
  52. @media screen and (max-width: 53.75rem) {
  53. .toolbar-tray-open.toolbar-vertical.toolbar-fixed .card-list--four-cols .card-list__item {
  54. flex-basis: 100%;
  55. max-width: 100%;
  56. margin-right: 0;
  57. margin-left: 0;
  58. }
  59. }
  60. @media screen and (min-width: 70rem) {
  61. .card-list--four-cols .card-list__item {
  62. flex-basis: var(--cards-three-cols-width);
  63. max-width: var(--cards-three-cols-width);
  64. }
  65. .card-list--four-cols .card-list__item:nth-child(even) {
  66. margin-right: var(--card-list-spacing);
  67. }
  68. [dir="rtl"] .card-list--four-cols .card-list__item:nth-child(even) {
  69. margin-right: 0;
  70. margin-left: var(--card-list-spacing);
  71. }
  72. .card-list--four-cols .card-list__item:nth-child(3n) {
  73. margin-right: 0;
  74. }
  75. [dir="rtl"] .card-list--four-cols .card-list__item:nth-child(3n) {
  76. margin-right: 0;
  77. margin-left: 0;
  78. }
  79. }
  80. @media screen and (min-width: 85.375rem) {
  81. .card-list--two-cols .card-list__item {
  82. flex-basis: var(--cards-two-cols-width);
  83. max-width: var(--cards-two-cols-width);
  84. margin-right: var(--card-list-spacing);
  85. }
  86. [dir="rtl"] .card-list--two-cols .card-list__item {
  87. margin-right: 0;
  88. margin-left: var(--card-list-spacing);
  89. }
  90. .card-list--two-cols .card-list__item:nth-child(even) {
  91. margin-right: 0;
  92. }
  93. [dir="rtl"] .card-list--two-cols .card-list__item:nth-child(even) {
  94. margin-right: 0;
  95. margin-left: 0;
  96. }
  97. .card-list--four-cols .card-list__item {
  98. flex-basis: var(--cards-four-cols-width);
  99. max-width: var(--cards-four-cols-width);
  100. }
  101. .card-list--four-cols .card-list__item:nth-child(even) {
  102. margin-right: var(--card-list-spacing);
  103. }
  104. [dir="rtl"] .card-list--four-cols .card-list__item:nth-child(even) {
  105. margin-right: 0;
  106. margin-left: var(--card-list-spacing);
  107. }
  108. .card-list--four-cols .card-list__item:nth-child(3n) {
  109. margin-right: var(--card-list-spacing);
  110. }
  111. [dir="rtl"] .card-list--four-cols .card-list__item:nth-child(3n) {
  112. margin-right: 0;
  113. margin-left: var(--card-list-spacing);
  114. }
  115. .card-list--four-cols .card-list__item:nth-child(4n) {
  116. margin-right: 0;
  117. }
  118. [dir="rtl"] .card-list--four-cols .card-list__item:nth-child(4n) {
  119. margin-right: 0;
  120. margin-left: 0;
  121. }
  122. }

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