I want to style responsive images. (I am running mediawiki 1.34.1 and I have the TemplateStyles extension installed.) Some Googling lead me to create a Template:ResponsiveImage
like:
<templatestyles src="ResponsiveImage/style.css" />
<div class="responsive-image">
{{{1}}}
</div>
with a style sheet Template:ResponsiveImage/style.css
like:
/* To make images responsive */
.responsive-image img {
max-width:100%;
height:auto;
}
So far so good. I can do {{ResponsiveImage|[[File:some image.png]]}}
and it fits across the full screen width and shrinks with the screen size.
But it would be neat to be able to pass max-width
to give other responsive width images, but I can't find any documentation or examples of how to do it. I've tried the obvious - max-width:{{{1}}};
- but just get an error
Invalid or unsupported value for property
max-width
at line 3 character 12.
Is there some way to do this? (Or any other way to make responsive images or arbitrary percentage of the screen width.)