modals.less 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. //
  2. // Modals
  3. // --------------------------------------------------
  4. // .modal-open - body class for killing the scroll
  5. // .modal - container to scroll within
  6. // .modal-dialog - positioning shell for the actual modal
  7. // .modal-content - actual modal w/ bg and corners and shit
  8. // Kill the scroll on the body
  9. .modal-open {
  10. overflow: hidden;
  11. }
  12. // Container that the modal scrolls within
  13. .modal {
  14. display: none;
  15. overflow: auto;
  16. overflow-y: scroll;
  17. position: fixed;
  18. top: 0;
  19. right: 0;
  20. bottom: 0;
  21. left: 0;
  22. z-index: @zindex-modal;
  23. -webkit-overflow-scrolling: touch;
  24. // Prevent Chrome on Windows from adding a focus outline. For details, see
  25. // https://github.com/twbs/bootstrap/pull/10951.
  26. outline: 0;
  27. // When fading in the modal, animate it to slide down
  28. &.fade .modal-dialog {
  29. .translate(0, -25%);
  30. .transition-transform(~'0.3s ease-out');
  31. }
  32. &.in .modal-dialog {
  33. // prettier-ignore
  34. .translate(0, 0);
  35. }
  36. }
  37. // Shell div to position the modal with bottom padding
  38. .modal-dialog {
  39. position: relative;
  40. width: auto;
  41. margin: 10px;
  42. }
  43. .modal-dialog-centered {
  44. display: flex;
  45. align-items: center;
  46. min-height: calc(100% - (30px * 2));
  47. .modal-content {
  48. width: 100%;
  49. }
  50. &.modal-dialog {
  51. margin-top: 30px;
  52. margin-bottom: 30px;
  53. }
  54. }
  55. // Actual modal
  56. .modal-content {
  57. position: relative;
  58. background-color: @modal-content-bg;
  59. border: 1px solid @modal-content-fallback-border-color; //old browsers fallback (ie8 etc)
  60. border: 1px solid @modal-content-border-color;
  61. border-radius: @border-radius-large;
  62. .box-shadow(0 3px 9px rgba(0, 0, 0, 0.5));
  63. background-clip: padding-box;
  64. // Remove focus outline from opened modal
  65. outline: none;
  66. }
  67. // Modal background
  68. .modal-backdrop {
  69. position: fixed;
  70. top: 0;
  71. right: 0;
  72. bottom: 0;
  73. left: 0;
  74. z-index: @zindex-modal-background;
  75. background-color: @modal-backdrop-bg;
  76. // Fade for backdrop
  77. &.fade {
  78. .opacity(0);
  79. }
  80. &.in {
  81. .opacity(@modal-backdrop-opacity);
  82. }
  83. }
  84. // Modal header
  85. // Top section of the modal w/ title and dismiss
  86. .modal-header {
  87. padding: @modal-title-padding;
  88. border-bottom: 1px solid @modal-header-border-color;
  89. min-height: (@modal-title-padding + @modal-title-line-height);
  90. }
  91. // Close icon
  92. .modal-header .close {
  93. margin-top: -2px;
  94. }
  95. .modal-header {
  96. h1,
  97. h2,
  98. h3,
  99. h4,
  100. h5 {
  101. margin: 0;
  102. font-family: @font-family-sans-serif;
  103. font-weight: 700;
  104. }
  105. }
  106. // Title text within header
  107. .modal-title {
  108. margin: 0;
  109. line-height: @modal-title-line-height;
  110. }
  111. // Modal body
  112. // Where all modal content resides (sibling of .modal-header and .modal-footer)
  113. .modal-body {
  114. position: relative;
  115. padding: @modal-inner-padding;
  116. }
  117. // Footer (for actions)
  118. .modal-footer {
  119. //margin-top: 15px;
  120. padding: (@modal-inner-padding - 1) @modal-inner-padding @modal-inner-padding;
  121. text-align: right; // right align buttons
  122. border-top: 1px solid @modal-footer-border-color;
  123. background-color: @modal-footer-background-color;
  124. border-radius: 0 0 @border-radius-large @border-radius-large;
  125. &:extend(.clearfix
  126. all); // clear it in case folks use .pull-* classes on buttons
  127. // Properly space out buttons
  128. .btn + .btn {
  129. margin-left: 5px;
  130. margin-bottom: 0; // account for input[type="submit"] which gets the bottom margin like all other inputs
  131. }
  132. // but override that for button groups
  133. .btn-group .btn + .btn {
  134. margin-left: -1px;
  135. }
  136. // and override it for block buttons as well
  137. .btn-block + .btn-block {
  138. margin-left: 0;
  139. }
  140. .modal-footer-left {
  141. float: left;
  142. }
  143. }
  144. // Scale up the modal
  145. @media (min-width: @screen-sm-min) {
  146. // Automatically set modal's width for larger viewports
  147. .modal-dialog {
  148. width: @modal-md;
  149. margin: 30px auto;
  150. }
  151. .modal-content {
  152. .box-shadow(0 5px 15px rgba(0, 0, 0, 0.5));
  153. }
  154. // Modal sizes
  155. .modal-sm {
  156. width: @modal-sm;
  157. }
  158. }
  159. @media (min-width: @screen-md-min) {
  160. .modal-lg {
  161. width: @modal-lg;
  162. }
  163. }