XIV

Source 📝

  • Offset: oTop and oLeft define the upper left corner of the cropped image
  • Crop: cWidth and cHeight define the size of the cropped image
  • Base Size: Offset and Crop are calculated as if the original file had the width bSize
{{CSS image crop
|Image = Dew on grass Luc Viatour.jpg
|bSize = 400
|cWidth = 100
|cHeight = 100
|oTop = 180
|oLeft = 60
}}

In addition, the cropped image can have a caption-text and be positioned on the page:

  • Location= to position (center, right, left, none)
  • Description= to add a text to the caption
A drop of dew on grass (focus on the drop)
A drop of dew on grass (focus on the drop)
{{CSS image crop
|Image = Dew on grass Luc Viatour.jpg
|bSize = 400
|cWidth = 100
|cHeight = 100
|oTop = 180
|oLeft = 60
|Location = center
|Description = A drop of dew on grass (focus on the drop)
}}

Groups of cropped images can be arranged in an image frame:

Aaron_Burden_2017-05-03_(Unsplash).jpg
Dew on Lemon Grass - Shola Gardens - Kotagiri.jpg
Dew on grass Luc Viatour.jpg
Dew and
Cropped images in a frame
{{Image frame|align=center|border=no|caption=Cropped images in a frame|content=
{{stack
|{{CSS image crop
|Image = Aaron_Burden_2017-05-03_(Unsplash).jpg
|bSize = 400
|cWidth = 100
|cHeight = 100
|oTop = 180
|oLeft = 60
}}
|{{CSS image crop
|Image = Dew on Lemon Grass - Shola Gardens - Kotagiri.jpg
|bSize = 400
|cWidth = 100
|cHeight = 100
|oTop = 180
|oLeft = 60
}}
}}
{{stack
|{{CSS image crop
|Image = Dew on grass Luc Viatour.jpg
|bSize = 400
|cWidth = 100
|cHeight = 100
|oTop = 180
|oLeft = 60
}}
|{{CSS image crop
|Image = Dew and grass - Flickr - Stiller Beobachter.jpg
|bSize = 400
|cWidth = 100
|cHeight = 100
|oTop = 180
|oLeft = 60
}}
}}
}}

Tracking categories

Scripts

The user script User:BrandonXLF/CSSImageCrop can be used to generate code to use this template with an interactive UI.

See also

The above documentation is transcluded from Template:CSS image crop/doc. (edit | history)
Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages.
Add categories to the /doc subpage. Subpages of this template.
Category:

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.