Template:Easy CSS image crop/doc
From Wikipedia, the free encyclopedia
This is intended to be an easier way to prepare {{CSS image crop}} crops, making it more intuitive and easier to guess what you'll get. It also allows for more predictable scaling: Want to make the image bigger after setting up a crop? Just change desired_width and the rest will follow.
This is a documentation subpage for Template:Easy CSS image crop. It may contain usage information, categories and other content that is not part of the original template page. |
This template uses Lua: |
{{Easy CSS image crop
|image = The name of the image file.
Do not include File: at the start. Just the base page name.
|desired_width = How wide the image should be after cropping. Defaults to 220.
|crop_left_perc = Percent to crop from the left, leaving out percentage sign (so 10.3% becomes 10.3)
|crop_right_perc = Percent to crop from the right.
|crop_top_perc = Percent to crop from the top.
|crop_bottom_perc = Percent to crop from the bottom.
|align = 'right', 'left', 'center' or 'none'. Determines placement of the image on the page
Defaults to 'right' when description is provided (as is default for thumb images)
When description is blank, it defaults to left (as is default for non-thumbs)
|location = may be used instead of |align = for compatibility with the old template.
|caption = Caption for the image (will render out using thumbnail class).
|description = can be used instead of |caption = for compatibility.
|link = Name of an article to be linked by clicking on the image (omit unless there is a
good reason to link to an article instead of the image).
|alt = The alt text for the image.
|page = The page of the file, if there are multiple pages (such as pdf files).
|magnify-link = The image to be linked by the magnify icon (Use if the image parameter is set to
{{Annotated image}} or the Link parameter leads to something other than the image).
}}
Basic parameters
{{Easy CSS image crop
|image = The name of the image file, e.g. Foo.jpg
|desired_width = How wide the image should be after cropping. Defaults to 220.
|crop_left_perc = Percent to crop from the left, leaving out percentage sign (so 10.3% becomes 10.3)
|crop_right_perc = Percent to crop from the right.
|crop_top_perc = Percent to crop from the top.
|crop_bottom_perc = Percent to crop from the bottom.
|alt = alternative text for the image (description for the blind)
}}
desired_width
can be left out if the default of 220 pixels wide is acceptable. Any of the crop percentage parameters can be left out if you don't want to crop from that side, but if you're not using at least one of them, why are you using this template? All crop parameters default to 0, which means nothing is cropped from that side. alt
is optional, but best practice is to include it.
In infoboxes, add the line:
|align = center
This causes it to behave as expected in an infobox.
For an image that renders as a thumbnail
{{Easy CSS image crop
|image = The name of the image file
|desired_width = How wide the image should be after cropping. Defaults to 220.
|crop_left_perc = Percent to crop from the left, leaving out percentage sign (so 10.3% becomes 10.3)
|crop_right_perc = Percent to crop from the right.
|crop_top_perc = Percent to crop from the top.
|crop_bottom_perc = Percent to crop from the bottom.
|caption = The image caption
|alt = alternative text for the image (description for the blind)
}}
alt
is optional, but best practice.