You are here

gridstack.css in GridStack 8.2

Same filename and directory in other branches
  1. 8 css/gridstack.css

This file is common to gridstack features: all layout engines.

The generic classes:

  • .gridstack: module class to abide by its namespace, just too generic.
  • .grid-stack: JS defined class, or managed by JS dynamically. Don't rely on this to avoid FOUC.

The following classes are not used for one-dimensional CSS driven layouts. Only applicable for two-dimensional: js-driven, native Grid and admin UI.

Original js-driven layouts:

  • .gridstack--gs (NOT used at admin UI, safe to use)
  • .is-gs-layout (Also used at admin UI, beware to not break it)

Native Grid layouts:

  • .gridstack--native (NOT used at admin UI, safe to use)

Both native Grid and js-driven layouts:

  • .gridstack--js
  • .is-gs-disabled (when being disabled)
  • .is-gs-enabled (when being enabled defined by minWidth option, or [data-gs-min-width])

Both front-end and back-end admin UI, beware to not break it:

  • .is-gs-layout (NOT safe to use at front-end, see below for recommendation)
  • .is-gs-enabled

Recommended front-end classes:

  • .gridstack--gs for the original js-driven layouts.
  • .gridstack--native for the native browser Grid Layout.
  • .gridstack-wrapper to hold background image/ media configurable via Layout Builder. Not currently used due to breaking LB AJAX. Might be for more complex needs.

Unless required, avoid js-generated classes to avoid FOUC: is-gs-on, etc.

File

css/gridstack.css
View source
  1. /**
  2. * @file
  3. * This file is common to gridstack features: all layout engines.
  4. *
  5. * The generic classes:
  6. * - .gridstack: module class to abide by its namespace, just too generic.
  7. * - .grid-stack: JS defined class, or managed by JS dynamically. Don't rely on
  8. * this to avoid FOUC.
  9. *
  10. * The following classes are not used for one-dimensional CSS driven layouts.
  11. * Only applicable for two-dimensional: js-driven, native Grid and admin UI.
  12. *
  13. * Original js-driven layouts:
  14. * - .gridstack--gs (NOT used at admin UI, safe to use)
  15. * - .is-gs-layout (Also used at admin UI, beware to not break it)
  16. *
  17. * Native Grid layouts:
  18. * - .gridstack--native (NOT used at admin UI, safe to use)
  19. *
  20. * Both native Grid and js-driven layouts:
  21. * - .gridstack--js
  22. * - .is-gs-disabled (when being disabled)
  23. * - .is-gs-enabled (when being enabled defined by minWidth option, or
  24. * [data-gs-min-width])
  25. *
  26. * Both front-end and back-end admin UI, beware to not break it:
  27. * - .is-gs-layout (NOT safe to use at front-end, see below for recommendation)
  28. * - .is-gs-enabled
  29. *
  30. * Recommended front-end classes:
  31. * - .gridstack--gs for the original js-driven layouts.
  32. * - .gridstack--native for the native browser Grid Layout.
  33. * - .gridstack-wrapper to hold background image/ media configurable via Layout
  34. * Builder. Not currently used due to breaking LB AJAX. Might be for more
  35. * complex needs.
  36. *
  37. * Unless required, avoid js-generated classes to avoid FOUC: is-gs-on, etc.
  38. */
  39. /* Ignorable, language dependent classes, original js-driven layouts. */
  40. .grid-stack-rtl {
  41. direction: ltr;
  42. }
  43. .grid-stack-rtl > .box {
  44. direction: rtl;
  45. }
  46. /* Required for background image to work for all engines. */
  47. .gridstack {
  48. position: relative;
  49. }
  50. /* Do not affect Bootstrap/ Foundation CSS. */
  51. .gridstack-wrapper,
  52. .gridstack--js {
  53. margin-left: auto;
  54. margin-right: auto;
  55. max-width: 100%;
  56. }
  57. .gridstack--js {
  58. min-height: 210px;
  59. overflow: hidden;
  60. transition: opacity .3s, visibility .3s;
  61. }
  62. /* Aspect ratio insanity. */
  63. .gridstack--js .box,
  64. /* Prevents overlapping bg when edge to edge (EtE) is not enabled. */
  65. .gridstack .box__content {
  66. overflow: hidden;
  67. }
  68. /* @todo required for rounded to work, but might break js. */
  69. .box__content.is-gs-media {
  70. margin-bottom: 0; /* Overrides bootstrap heading classes from making headaches. */
  71. position: relative;
  72. }
  73. /* Reveals media element (IMG, IFRAME, VIDEO) for Edge to Edge (EtE). */
  74. .gridstack.is-gs-ete,
  75. .gridstack .box--ete,
  76. .gridstack .box--ete > .box__content,
  77. .gridstack .box__content.is-gs-ete {
  78. overflow: visible;
  79. }
  80. /* Intentional specificity to not break, to look gapless, including disabled. */
  81. /* The .b-noratio is specific for Blazy inside blocks. */
  82. .gridstack--js .b-noratio img,
  83. .gridstack--js .b-noratio iframe,
  84. .gridstack--js .b-noratio video,
  85. /* The .box__bg is specific for Media Library item via LB, non-block. */
  86. .gridstack .box__bg img,
  87. .gridstack .box__bg iframe,
  88. .gridstack .box__bg video,
  89. .gridstack .b-gs .media__overlay {
  90. display: block;
  91. height: 100%;
  92. left: 0;
  93. max-width: 100%;
  94. min-height: 1px;
  95. object-fit: cover;
  96. overflow: hidden;
  97. position: absolute;
  98. top: 0;
  99. width: 100%;
  100. z-index: 0;
  101. }
  102. /* Background color over image needs this. */
  103. .gridstack .b-gs .media__overlay {
  104. z-index: 1;
  105. }
  106. /* @todo in case we can make inline media (non-background) work with EtE. We do! */
  107. .gridstack .b-gs,
  108. .gridstack .box__animated,
  109. .gridstack--js .b-noratio,
  110. .gridstack--js .box__content > a {
  111. height: 100%;
  112. object-fit: cover;
  113. width: 100%;
  114. }
  115. /** Override core block.css margin which adds extra gap confusing aspect ratio. */
  116. .gridstack .block,
  117. .gridstack .block .content,
  118. .gridstack .block .block__content,
  119. .gridstack .block h2 { /* csslint allow: qualified-headings */
  120. margin-top: 0;
  121. }