Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Usage  





2 Examples  





3 Tracking categories  





4 Scripts  





5 See also  














Template:CSS image crop






Afrikaans
العربية
Արեւմտահայերէն
Авар
Azərbaycanca
تۆرکجه
Basa Bali

 / Bân-lâm-gú
Беларуская
Беларуская (тарашкевіца)
Български
Bosanski
Буряад
Català
Čeština
Corsu
Cymraeg
Dansk
Deutsch
Eesti
Español
فارسی
Français
Galego

Հայերեն
ि
Hrvatski
Ido
Ilokano
Bahasa Indonesia
Interlingua
Italiano
עברית
Jawa


Қазақша
Latviešu
Magyar
ि
Македонски

Bahasa Melayu
Mirandés

Nederlands


Нохчийн
Norsk nynorsk
Occitan
ି
Oʻzbekcha / ўзбекча

Português
Română
Русский

Scots
Shqip
Simple English
Slovenščina
Српски / srpski
Srpskohrvatski / српскохрватски
Sunda
Suomi
Svenska
Tagalog
ி


Тоҷикӣ
Türkçe
Українська
اردو
Tiếng Vit


 

Edit links
 









Template
Talk
 

















Read
View source
View history
 








Tools
   


Actions  



Read
View source
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 




In other projects  



Wikimedia Commons
Meta-Wiki
Wikibooks
Wikisource
Wikivoyage
 
















Appearance
   

 





Permanently protected template

From Wikipedia, the free encyclopedia
 


See also Template:Easy CSS image crop, which simplifies the interface for this template a bit.

{{CSS image crop}} creates a crop of an image inline for previewing the look and feel of a page, or for linking to full images when a slight crop is preferred in an article, but the full image is more encyclopaedic in general. Where only a small section of the image is used after the crop, it's best to upload the crop as a new file, to avoid sending the extra image data to users.

Note: There was a previous glitch for which some people had to use "tleft" "tright" etc. as a workaround because "left" and "right" did not work. As a result, to avoid having to fix all those pages that used the workaround, the template has been designed to function properly regardless of whether tright or right is used. See template talk for details.

Usage

{{CSS image crop
|Image         = The Name of the image file, or may accept {{Annotated image}}.
|bSize         = The Base Image width in pixels (the image we are cropping on)
|cWidth        = Crop Image Width in pixels
|cHeight       = Crop image Height in pixels
|oTop          = Offset Top in pixels, optional and defaults to 0 when omitted
|oLeft         = Offset Left in pixels, optional and defaults to 0 when omitted
|Location      = '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, location on left (as is default for non-thumbs)
|Description   = Description (will render out using thumbnail class)
|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).
}}

Examples

Create a cropped image of a single water drop:

Thumbnail of the original file
Dew on grass Luc Viatour.jpg

{{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:

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 grass - Flickr - Stiller Beobachter.jpg
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


Retrieved from "https://en.wikipedia.org/w/index.php?title=Template:CSS_image_crop&oldid=1203951760"

Category: 
Image formatting and function templates
Hidden category: 
Wikipedia template-protected templates
 



This page was last edited on 6 February 2024, at 01:45 (UTC).

Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



Privacy policy

About Wikipedia

Disclaimers

Contact Wikipedia

Code of Conduct

Developers

Statistics

Cookie statement

Mobile view



Wikimedia Foundation
Powered by MediaWiki