modals.less 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. // Account for hiding of scrollbar
  12. body&,
  13. .navbar-fixed-top,
  14. .navbar-fixed-bottom {
  15. margin-right: 15px
  16. }
  17. }
  18. // Container that the modal scrolls within
  19. .modal {
  20. display: none;
  21. overflow: auto;
  22. overflow-y: scroll;
  23. position: fixed;
  24. top: 0;
  25. right: 0;
  26. bottom: 0;
  27. left: 0;
  28. z-index: @zindex-modal-background;
  29. // When fading in the modal, animate it to slide down
  30. &.fade .modal-dialog {
  31. .translate(0, -25%);
  32. .transition-transform(~"0.3s ease-out");
  33. }
  34. &.in .modal-dialog { .translate(0, 0)}
  35. }
  36. // Shell div to position the modal with bottom padding
  37. .modal-dialog {
  38. margin-left: auto;
  39. margin-right: auto;
  40. width: auto;
  41. padding: 10px;
  42. z-index: (@zindex-modal-background + 10);
  43. }
  44. // Actual modal
  45. .modal-content {
  46. position: relative;
  47. background-color: @modal-content-bg;
  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. background-clip: padding-box;
  53. // Remove focus outline from opened modal
  54. outline: none;
  55. }
  56. // Modal background
  57. .modal-backdrop {
  58. position: fixed;
  59. top: 0;
  60. right: 0;
  61. bottom: 0;
  62. left: 0;
  63. z-index: (@zindex-modal-background - 10);
  64. background-color: @modal-backdrop-bg;
  65. // Fade for backdrop
  66. &.fade { .opacity(0); }
  67. &.in { .opacity(.5); }
  68. }
  69. // Modal header
  70. // Top section of the modal w/ title and dismiss
  71. .modal-header {
  72. padding: @modal-title-padding;
  73. border-bottom: 1px solid @modal-header-border-color;
  74. min-height: (@modal-title-padding + @modal-title-line-height);
  75. }
  76. // Close icon
  77. .modal-header .close {
  78. margin-top: -2px;
  79. }
  80. // Title text within header
  81. .modal-title {
  82. margin: 0;
  83. line-height: @modal-title-line-height;
  84. }
  85. // Modal body
  86. // Where all modal content resides (sibling of .modal-header and .modal-footer)
  87. .modal-body {
  88. position: relative;
  89. padding: @modal-inner-padding;
  90. }
  91. // Footer (for actions)
  92. .modal-footer {
  93. margin-top: 15px;
  94. padding: (@modal-inner-padding - 1) @modal-inner-padding @modal-inner-padding;
  95. text-align: right; // right align buttons
  96. border-top: 1px solid @modal-footer-border-color;
  97. .clearfix(); // clear it in case folks use .pull-* classes on buttons
  98. // Properly space out buttons
  99. .btn + .btn {
  100. margin-left: 5px;
  101. margin-bottom: 0; // account for input[type="submit"] which gets the bottom margin like all other inputs
  102. }
  103. // but override that for button groups
  104. .btn-group .btn + .btn {
  105. margin-left: -1px;
  106. }
  107. // and override it for block buttons as well
  108. .btn-block + .btn-block {
  109. margin-left: 0;
  110. }
  111. }
  112. // Scale up the modal
  113. @media screen and (min-width: @screen-tablet) {
  114. .modal-dialog {
  115. left: 50%;
  116. right: auto;
  117. width: 600px;
  118. padding-top: 30px;
  119. padding-bottom: 30px;
  120. }
  121. .modal-content {
  122. .box-shadow(0 5px 15px rgba(0,0,0,.5));
  123. }
  124. }