Debian Codegraph @

skins/MinervaNeue/resources/skins.minerva.base.styles/content/images.less

raw
1 // Full-size images
2 //
3 // Inline and floated full-size images will be styled like so.
4 //
5 // Example wikitext:
6 // This is an [[File:Book.png]] inline image.
7 // [[File:Book.png|left]]Left-aligned image
8 // [[File:Book.png|right]]Right-aligned image
9 //
10 // Markup:
11 // <div class="content">
12 // <p>This is an <img src="images/arrow-left.png"> inline image.</p>
13 // <div class="floatleft"><img src="images/arrow-left.png">Left-aligned image</div>
14 // <div class="floatright"><img src="images/arrow-left.png">Right-aligned image</div>
15 // </div>
16 @import 'mediawiki.mixins.less';
17 @import '../../../minerva.less/minerva.variables.less';
18 @import '../../../minerva.less/minerva.mixins.less';
19
20 @margin-floatright: 0 0 0.6em 0.6em;
21 @margin-floatleft: 0 0.6em 0.6em 0;
22
23 .content {
24 img {
25 // Matches commonElements.css
26 vertical-align: middle;
27 }
28
29 // Applied to divs containing aligned, full-size images
30 .floatright {
31 /* @noflip */
32 clear: right;
33 /* @noflip */
34 float: right;
35 /* @noflip */
36 margin: @margin-floatright;
37 }
38
39 // Applied to divs containing aligned, full-size images
40 .floatleft {
41 /* @noflip */
42 clear: left;
43 /* @noflip */
44 float: left;
45 /* @noflip */
46 margin: @margin-floatleft;
47 }
48
49 // Prevent inline styles on images in wikitext
50 // Note we restrict to img's to avoid conflicts with VisualEditor shields
51 // See bug T64460
52 // due to lazy loading images we also must consider imgs inside noscript tags (T191893)
53 a > img,
54 noscript > img {
55 // make sure that images in articles don't cause a horizontal scrollbar
56 // on small screens
57 max-width: 100% !important;
58
59 // Note height auto is only applied to images. Not neeed for the lazy-image-placeholder which is
60 // a gray box and will cause reflows.
61 height: auto !important;
62 }
63
64 // bug T22030
65 .noresize {
66 max-width: 100%;
67 overflow-x: auto;
68
69 a > img {
70 max-width: none !important;
71 }
72 }
73
74 figure[ typeof~='mw:File' ],
75 figure[ typeof~='mw:File/Frameless' ] {
76 display: table;
77 border-collapse: collapse;
78
79 &.mw-halign-right {
80 /* @noflip */
81 margin: @margin-floatright;
82 /* @noflip */
83 clear: right;
84 /* @noflip */
85 float: right;
86 }
87
88 &.mw-halign-left {
89 /* @noflip */
90 margin: @margin-floatleft;
91 /* @noflip */
92 clear: left;
93 /* @noflip */
94 float: left;
95 }
96
97 &.mw-halign-none {
98 clear: none;
99 float: none;
100 }
101
102 &.mw-halign-center {
103 margin: 0 auto;
104 clear: none;
105 float: none;
106 }
107
108 > figcaption {
109 // Hide the caption for frameless and plain floated images
110 display: none;
111 }
112 }
113 }
114
115 .dark-mode-image-styles() {
116 /* Desktop legacy HTML */
117 .mw-parser-output,
118 /* Parsoid HTML (mobile) */
119 section .mw-heading ~ div,
120 /* Parsoid HTML (desktop) and mobile legacy HTML */
121 section,
122 /* e.g. https://en.wikipedia.org/wiki/Pullback_(category_theory)#Universal_property */
123 dd,
124 /* For targeting p span.mw-default-size */
125 p {
126 > span.mw-default-size,
127 > figure[ typeof='mw:File' ],
128 > figure[ typeof='mw:File/Thumb' ],
129 > figure[ typeof='mw:File/Frameless' ] {
130 img {
131 background-color: #c8ccd1;
132 }
133 }
134 }
135 }
136
137 @media screen {
138 html.skin-theme-clientpref-night {
139 .dark-mode-image-styles();
140 }
141 }
142
143 @media screen and ( prefers-color-scheme: dark ) {
144 html.skin-theme-clientpref-os {
145 .dark-mode-image-styles();
146 }
147 }