card.pcss.css

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

Card.

File

core/themes/claro/css/components/card.pcss.css

View source
  1. /**
  2. * @file
  3. * Card.
  4. */
  5. :root {
  6. --card-bg-color: var(--color-white);
  7. --card-border-size: 1px;
  8. --card-border-color: var(--color-gray-200-o-80);
  9. --card-border-radius-size: var(--base-border-radius);
  10. --card-image-border-radius-size: calc(var(--card-border-radius-size) - var(--card-border-size));
  11. --card-box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  12. }
  13. .card {
  14. display: flex;
  15. flex-direction: column;
  16. align-items: stretch;
  17. justify-items: flex-start;
  18. padding: 0;
  19. border: var(--card-border-size) solid var(--card-border-color);
  20. border-radius: var(--card-border-radius-size);
  21. background-color: var(--card-bg-color);
  22. box-shadow: var(--card-box-shadow);
  23. }
  24. /* 588px theme screenshot width */
  25. @media screen and (min-width: 36.75rem) {
  26. .card--horizontal {
  27. flex-direction: row;
  28. }
  29. .toolbar-tray-open.toolbar-vertical.toolbar-fixed .card--horizontal {
  30. flex-direction: column;
  31. }
  32. }
  33. /* 53.75rem it is width of screenshot image + toolbar width(15rem) + 2rem of margins. */
  34. @media screen and (min-width: 53.75rem) {
  35. .toolbar-tray-open.toolbar-vertical.toolbar-fixed .card--horizontal {
  36. flex-direction: row;
  37. }
  38. }
  39. /**
  40. * Card image.
  41. */
  42. .card__image {
  43. overflow: hidden;
  44. border-radius: var(--card-image-border-radius-size) var(--card-image-border-radius-size) 0 0;
  45. line-height: 0;
  46. }
  47. @media screen and (min-width: 36.75rem) {
  48. .card--horizontal .card__image {
  49. flex-basis: 35%;
  50. border-start-start-radius: var(--card-image-border-radius-size);
  51. border-start-end-radius: 0;
  52. border-end-start-radius: var(--card-image-border-radius-size);
  53. border-end-end-radius: 0;
  54. }
  55. }
  56. /* 53.75rem it is width of screenshot image + toolbar width(15rem) + 2rem of margins. */
  57. @media screen and (max-width: 53.75rem) {
  58. .toolbar-tray-open.toolbar-vertical.toolbar-fixed .card--horizontal .card__image {
  59. flex-basis: auto;
  60. }
  61. }
  62. @media screen and (min-width: 85.375rem) {
  63. .card--horizontal .card__image {
  64. flex-basis: 45%;
  65. }
  66. /* .card--vertical .card__image {
  67. flex-basis: auto;
  68. } */
  69. }
  70. /**
  71. * Card content.
  72. */
  73. .card__content-wrapper {
  74. display: flex;
  75. flex-direction: column;
  76. flex-grow: 1;
  77. flex-shrink: 0;
  78. box-sizing: border-box;
  79. padding: var(--space-l);
  80. }
  81. @media screen and (min-width: 36.75rem) {
  82. .card--horizontal .card__content-wrapper {
  83. flex-basis: 65%;
  84. }
  85. /* Card content with image. */
  86. .card--horizontal .card__image ~ .card__content-wrapper {
  87. padding-inline-start: var(--space-m);
  88. }
  89. }
  90. @media screen and (max-width: 53.75rem) {
  91. .toolbar-tray-open.toolbar-vertical.toolbar-fixed .card--horizontal .card__content-wrapper {
  92. flex-basis: auto;
  93. }
  94. }
  95. @media screen and (min-width: 85.375rem) {
  96. .card--horizontal .card__content-wrapper {
  97. flex-basis: 55%;
  98. }
  99. }
  100. /**
  101. * Card content.
  102. */
  103. .card__content {
  104. flex-grow: 1;
  105. }
  106. /**
  107. * Card content items (title, description).
  108. */
  109. .card__content-item {
  110. margin-block: 0 var(--space-m);
  111. &:last-child {
  112. margin-block-end: 0;
  113. }
  114. }
  115. /**
  116. * Card footer.
  117. */
  118. .card__footer {
  119. order: 100;
  120. margin-block-start: var(--space-l);
  121. }
  122. .card__footer .action-links {
  123. margin-block: 0;
  124. text-align: right; /* LTR */
  125. @nest [dir="rtl"]
  126. }

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