-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
content.media-common.less
250 lines (216 loc) · 4.94 KB
/
content.media-common.less
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
/* stylelint-disable selector-class-pattern */
@import 'mediawiki.skin.variables.less';
@import 'content.variables.less';
/**
* Block media items
*/
figure[ typeof~='mw:File' ],
figure[ typeof~='mw:File/Frameless' ] {
> a {
// The addition of the class is needed for higher specificity
// than Vector's print styles
.mw-body-content & {
border: 0;
}
}
&.mw-halign-right {
/* @noflip */
margin: @margin-floatright;
/* @noflip */
clear: right;
/* @noflip */
float: right;
}
&.mw-halign-left {
/* @noflip */
margin: @margin-floatleft;
/* @noflip */
clear: left;
/* @noflip */
float: left;
}
&.mw-halign-none {
clear: none;
float: none;
}
&.mw-halign-center {
/* Matches *.center * in element.css */
margin: 0 auto;
display: table;
border-collapse: collapse;
clear: none;
float: none;
}
/* Hide the caption for frameless and plain floated images */
> figcaption {
display: none;
}
}
figure[ typeof~='mw:File/Thumb' ],
figure[ typeof~='mw:File/Frame' ] {
display: table;
text-align: center;
border-collapse: collapse;
line-height: 0;
> a {
// The addition of the class is needed for higher specificity
// than Vector's print styles
.mw-body-content & {
border: 0;
}
}
// Default where page content language is not set
// Allow to flip
margin: @margin-tright;
clear: right;
float: right;
// Defaults for page content language
.mw-content-ltr & {
/* @noflip */
margin: @margin-tright;
/* @noflip */
clear: right;
/* @noflip */
float: right;
}
.mw-content-rtl & {
/* @noflip */
margin: @margin-tleft;
/* @noflip */
clear: left;
/* @noflip */
float: left;
}
// Override defaults when explicitly set
// Order of application is important, so don't combine with the defaults
&.mw-halign-right {
/* @noflip */
margin: @margin-tright;
/* @noflip */
clear: right;
/* @noflip */
float: right;
}
&.mw-halign-left {
/* @noflip */
margin: @margin-tleft;
/* @noflip */
clear: left;
/* @noflip */
float: left;
}
&.mw-halign-none {
/* Override the default margin from mw-content-xxx above */
margin: 0;
margin-bottom: @margin-bottom-thumb;
clear: none;
float: none;
}
&.mw-halign-center {
/* Override the default margin from mw-content-xxx above
* And, matches *.center * in element.css
*/
margin: 0 auto @margin-bottom-thumb auto;
clear: none;
float: none;
}
> :not( figcaption ) {
.mw-file-element {
margin: 3px;
}
/**
* Broken media get a span instead.
*/
.mw-broken-media {
display: inline-block;
line-height: 1.6em;
word-break: break-word; // Same as in the figcaption
/* This is hardcoded in Linker::makeThumbLink2 for broken media */
width: 180px;
/* Styles the text of broken media */
font-size: @font-size-thumbinner-screen;
}
}
> figcaption {
display: table-caption;
caption-side: bottom;
line-height: @line-height-thumbcaption;
/**
* The "break-word" value is deprecated, however, it's well supported
* at 94.73%
* https://caniuse.com/mdn-css_properties_word-break_break-word
*
* The spec suggests it has the same effect as,
*
* word-break: normal;
* overflow-wrap: anywhere;
*
* https://drafts.csswg.org/css-text-3/#word-break-property
*
* So, we should use that. However, support for "anywhere" is lagging
* at just 72.39%, with Safari being a notable miss.
* https://caniuse.com/mdn-css_properties_overflow-wrap_anywhere
*
* "Soft wrap opportunities introduced by the word break are considered
* when calculating min-content intrinsic sizes."
* From https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap
*/
word-break: break-word;
text-align: start;
/* taken from .thumbcaption, plus .thumbinner */
padding: 0 6px 6px 6px;
}
}
/**
* Disable floating on mobile devices and automatically center on the page.
* This overrides any inline styles in the process.
*/
figure {
body.skin--responsive & {
@media all and ( max-width: @max-width-breakpoint-mobile ) {
/* stylelint-disable-next-line declaration-no-important */
margin: 0 auto !important;
/* stylelint-disable-next-line declaration-no-important */
float: none !important;
}
}
}
figcaption:empty {
// Remove bogus padding from framed images without captions
figure[ typeof~='mw:File/Frame' ] > & {
padding-bottom: 0;
}
// However, it's still necessary for thumbs because the magnifying icon is present
figure[ typeof~='mw:File/Thumb' ] > & {
padding-bottom: 3px;
}
}
/**
* Inline media items
*/
.mw-file-element {
.mw-valign-middle & {
vertical-align: middle;
}
.mw-valign-baseline & {
vertical-align: baseline;
}
.mw-valign-sub & {
vertical-align: sub;
}
.mw-valign-super & {
vertical-align: super;
}
.mw-valign-top & {
vertical-align: top;
}
.mw-valign-text-top & {
vertical-align: text-top;
}
.mw-valign-bottom & {
vertical-align: bottom;
}
.mw-valign-text-bottom & {
vertical-align: text-bottom;
}
}