modals.less 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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: hidden;
  16. position: fixed;
  17. top: 0;
  18. right: 0;
  19. bottom: 0;
  20. left: 0;
  21. z-index: @zindex-modal;
  22. -webkit-overflow-scrolling: touch;
  23. // Prevent Chrome on Windows from adding a focus outline. For details, see
  24. // https://github.com/twbs/bootstrap/pull/10951.
  25. outline: 0;
  26. // When fading in the modal, animate it to slide down
  27. &.fade .modal-dialog {
  28. .translate(0, -25%);
  29. .transition-transform(~"0.3s ease-out");
  30. }
  31. &.in .modal-dialog { .translate(0, 0) }
  32. }
  33. .modal-open .modal {
  34. overflow-x: hidden;
  35. overflow-y: auto;
  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. // Actual modal
  44. .modal-content {
  45. position: relative;
  46. // background-color: @modal-content-bg;
  47. border: 1px solid @modal-content-fallback-border-color; //old browsers fallback (ie8 etc)
  48. border: 1px solid @modal-content-border-color;
  49. // border-radius: @border-radius-large;
  50. //.box-shadow(0 3px 9px rgba(0,0,0,.5));
  51. .box-shadow(0 3px 2px rgba(0,0,0,.5));
  52. background-clip: padding-box;
  53. // Remove focus outline from opened modal
  54. outline: 0;
  55. background: @brand-info;
  56. color: @body-bg;
  57. }
  58. // Modal background
  59. .modal-backdrop {
  60. position: fixed;
  61. top: 0;
  62. right: 0;
  63. bottom: 0;
  64. left: 0;
  65. z-index: @zindex-modal-background;
  66. // background-color: @modal-backdrop-bg;
  67. background-color: @body-bg;
  68. // Fade for backdrop
  69. &.fade { .opacity(0); }
  70. &.in { .opacity(@modal-backdrop-opacity); }
  71. }
  72. // Modal header
  73. // Top section of the modal w/ title and dismiss
  74. .modal-header {
  75. padding: @modal-title-padding;
  76. border-bottom: 1px solid @modal-header-border-color;
  77. min-height: (@modal-title-padding + @modal-title-line-height);
  78. }
  79. // Close icon
  80. .modal-header .close {
  81. margin-top: -2px;
  82. }
  83. // Title text within header
  84. .modal-title {
  85. margin: 0;
  86. line-height: @modal-title-line-height;
  87. }
  88. // Modal body
  89. // Where all modal content resides (sibling of .modal-header and .modal-footer)
  90. .modal-body {
  91. position: relative;
  92. padding: @modal-inner-padding;
  93. }
  94. // Footer (for actions)
  95. .modal-footer {
  96. padding: @modal-inner-padding;
  97. text-align: right; // right align buttons
  98. border-top: 1px solid @modal-footer-border-color;
  99. &:extend(.clearfix all); // clear it in case folks use .pull-* classes on buttons
  100. // Properly space out buttons
  101. .btn + .btn {
  102. margin-left: 5px;
  103. margin-bottom: 0; // account for input[type="submit"] which gets the bottom margin like all other inputs
  104. }
  105. // but override that for button groups
  106. .btn-group .btn + .btn {
  107. margin-left: -1px;
  108. }
  109. // and override it for block buttons as well
  110. .btn-block + .btn-block {
  111. margin-left: 0;
  112. }
  113. }
  114. // Measure scrollbar width for padding body during modal show/hide
  115. .modal-scrollbar-measure {
  116. position: absolute;
  117. top: -9999px;
  118. width: 50px;
  119. height: 50px;
  120. overflow: scroll;
  121. }
  122. // Scale up the modal
  123. @media (min-width: @screen-sm-min) {
  124. // Automatically set modal's width for larger viewports
  125. .modal-dialog {
  126. width: @modal-md;
  127. margin: 30px auto;
  128. }
  129. .modal-content {
  130. //.box-shadow(0 5px 15px rgba(0,0,0,.5));
  131. .box-shadow(0 5px 2px rgba(0,0,0,.5));
  132. }
  133. // Modal sizes
  134. .modal-sm { width: @modal-sm; }
  135. }
  136. @media (min-width: @screen-md-min) {
  137. .modal-lg { width: @modal-lg; }
  138. }