modals.less 3.0 KB

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