modals.less 3.4 KB

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