modals.less 3.5 KB

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