modals.less 2.92 KB
Newer Older
1
2
3
4
//
// Modals
// --------------------------------------------------

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// .modal-open      - body class for killing the scroll
// .modal           - container to scroll within
// .modal-dialog    - positioning shell for the actual modal
// .modal-content   - actual modal w/ bg and corners and shit

// Kill the scroll on the body
.modal-open {
  overflow: hidden;
}

// Container that the modal scrolls within
.modal {
  display: none;
  overflow: auto;
  overflow-y: scroll;
20
21
22
23
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
24
  left: 0;
25
  z-index: @zindex-modal-background;
26
  -webkit-overflow-scrolling: touch;
Mark Otto's avatar
Mark Otto committed
27
28
29
30
31
32
33

  // When fading in the modal, animate it to slide down
  &.fade {
    top: -25%;
    .transition(~"opacity 0.3s linear, top 0.3s ease-out");
  }
  &.fade.in { top: 0; }
Mark Otto's avatar
Mark Otto committed
34
}
35

36
37
38
39
40
41
42
43
44
// Shell div to position the modal with bottom padding
.modal-dialog {
  position: relative;
  top: 0;
  left: 0;
  right: 0;
  width: auto;
  padding: 10px;
  z-index: @zindex-modal-background + 10;
45
46
}

47
48
49
// Actual modal
.modal-content {
  position: relative;
50
  background-color: #fff;
51
  border: 1px solid #999;
Mark Otto's avatar
Mark Otto committed
52
  border: 1px solid rgba(0,0,0,.2);
53
  border-radius: 6px;
Mark Otto's avatar
Mark Otto committed
54
  .box-shadow(0 3px 9px rgba(0,0,0,.5));
55
  .background-clip(padding-box);
Mark Otto's avatar
Mark Otto committed
56
57
  // Remove focus outline from opened modal
  outline: none;
58
}
59
60
61
62
63
64
65
66
67

// Modal background
.modal-backdrop {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: @zindex-modal-background - 10;
Mark Otto's avatar
Mark Otto committed
68
  background-color: #000;
69
70
  // Fade for backdrop
  &.fade { opacity: 0; }
Mark Otto's avatar
Mark Otto committed
71
  &.fade.in { .opacity(50);}
72
73
74
75
}

// Modal header
// Top section of the modal w/ title and dismiss
76
.modal-header {
77
  padding: 9px 15px;
78
79
80
81
82
83
84
85
86
87
88
  border-bottom: 1px solid #e5e5e5;
}
// Close icon
.modal-header .close {
  margin-top: 2px;
}

// Title text within header
.modal-title {
  margin: 0;
  line-height: 30px; // effectively set a min-height for the header
89
}
90

91
92
// Modal body
// Where all modal content resides (sibling of .modal-header and .modal-footer)
93
.modal-body {
94
  position: relative;
Mark Otto's avatar
Mark Otto committed
95
  padding: @modal-inner-padding;
96
}
97
98

// Footer (for actions)
99
.modal-footer {
100
  margin-top: 15px;
Mark Otto's avatar
Mark Otto committed
101
  padding: (@modal-inner-padding - 1) @modal-inner-padding @modal-inner-padding;
102
  text-align: right; // right align buttons
103
  border-top: 1px solid #e5e5e5;
104
105
106
107
  .clearfix(); // clear it in case folks use .pull-* classes on buttons

  // Properly space out buttons
  .btn + .btn {
108
    margin-left: 5px;
109
    margin-bottom: 0; // account for input[type="submit"] which gets the bottom margin like all other inputs
110
  }
111
112
113
114
  // but override that for button groups
  .btn-group .btn + .btn {
    margin-left: -1px;
  }
115
116
117
118
  // and override it for block buttons as well
  .btn-block + .btn-block {
    margin-left: 0;
  }
119
}
120

Mark Otto's avatar
Mark Otto committed
121
// Scale up the modal
122
123
124
125
126
127
128
129
130
131
@media screen and (min-width: 768px) {

  .modal-dialog {
    left: 50%;
    right: auto;
    width: 560px;
    margin-left: -280px;
    padding-top: 30px;
    padding-bottom: 30px;
  }
Mark Otto's avatar
Mark Otto committed
132
133
134
  .modal-content {
    .box-shadow(0 5px 15px rgba(0,0,0,.5));
  }
135
136

}