Difference between revisions of "Help:TestImageWidth"
Jump to navigation
Jump to search
m (Sisussman moved page X:TestImageWidth to Help:TestImageWidth without leaving a redirect) |
|||
| (3 intermediate revisions by the same user not shown) | |||
| Line 14: | Line 14: | ||
</div> | </div> | ||
| − | They talk about modifying your Wiki's MediaWiki:Common.css page but I learned that that isn't a good idea and I should use TemplateStyle instead, so I created <code>Template:ResponsiveImage</code> thus: | + | They talk about modifying your Wiki's <code>MediaWiki:Common.css</code> page but I learned that that isn't a good idea and I should use TemplateStyle instead, so I created <code>Template:ResponsiveImage</code> thus: |
<pre> | <pre> | ||
<templatestyles src="ResponsiveImage/style.css" /> | <templatestyles src="ResponsiveImage/style.css" /> | ||
| Line 40: | Line 40: | ||
[[File:Warming stripes GLOBAL 1850-2019 nolabels 100h.png]] | [[File:Warming stripes GLOBAL 1850-2019 nolabels 100h.png]] | ||
}} | }} | ||
| + | |||
| + | == AdaptiveThumb == | ||
| + | <pre> | ||
| + | <pic src="Warming stripes GLOBAL 1850-2019 nolabels 100h.png" width=80% caption="Ed Hawkins' Global Warming Stripes" /> | ||
| + | </pre> | ||
| + | looks for an external file and produces a load of php warnings on the page about missing parameters like title, alt, border, margin. | ||
Latest revision as of 17:39, 15 April 2021
From https://www.mediawiki.org/wiki/Topic:Tuubagqalz9vk2m9 I learned about making a css class to style responsive images
AhmadF.Cheema commented that using an inline div doesn't work:
<div style="max-width:100%; height:auto;"> [[File:Warming stripes GLOBAL 1850-2019 nolabels 100h.png]] </div>
gives this:
They talk about modifying your Wiki's MediaWiki:Common.css page but I learned that that isn't a good idea and I should use TemplateStyle instead, so I created Template:ResponsiveImage thus:
<templatestyles src="ResponsiveImage/style.css" />
<div class="responsive-image">
{{{1}}}
</div>
and Template:ResponsiveImage/style.css thus:
/* To make images responsive */
.responsive-image img {
max-width:100%;
height:auto;
}
With that I can do this:
{{ResponsiveImage|
[[File:Warming stripes GLOBAL 1850-2019 nolabels 100h.png]]
}}
and it gives me this:
AdaptiveThumb
<pic src="Warming stripes GLOBAL 1850-2019 nolabels 100h.png" width=80% caption="Ed Hawkins' Global Warming Stripes" />
looks for an external file and produces a load of php warnings on the page about missing parameters like title, alt, border, margin.
