সমললৈ যাওক

সাঁচ:Img float

ৱিকিউৎসৰ পৰা

Creates floating image and caption.

{{Img float
 | style =
 | above =
 | file     = 
 | width    = 
 | align    = 
 | polygon  = 
 | cap      = 
 | capalign = 
 | alt      = 
}}
  • style: add css style attributes. If you change font size by percent you should also change line-height. For example if you want font-size to be 80%: | style = font-size: 80%; line-height: 80%;
  • above: add text above picture
  • file: The file name (without the "File:" prefix) (mandatory parameter)
  • width: The width of the image (optional, default 150px)
  • align: The alignment of the image on the page ("left", "right" or "center"; default "right")
  • polygon: Polygon shape outline to allow text to wrap closer to the image if the image is not a rectangle (optional, co-ordinates as comma separated pairs)
  • cap: The image caption (optional). Do not use any <div> or div-based templates such as {{smaller block}} if the template is located in the middle of a paragraph as Mediwiki will add a paragraph break.
  • capalign: The image caption text alignment ("left", "right" or "center"; default "center")
  • alt: Image alt-text, ie. for mouse-over text box or for use with a screenreader for the visually impaired (optional)
 

Because this is a span-based template (to allow it to "float" within paragraphs without breaking the paragraph), it is disallowed to use block formatting (for example {{center}} or {{smaller block}}) in the captions.

{{Img float
 | file     = The Kinematics of Machinery Fig 2.jpg
 | width    = 250px
 | align    = right
 | cap      = Fig. 2.
}}


Fig. 2.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

{{Img float
 | file     = The Kinematics of Machinery Fig 2.jpg
 | width    = 250px
 | align    = left
 | cap      = Fig. 2.
}}


Fig. 2.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Left aligned image caption

[সম্পাদনা কৰক]
{{Img float
 | file     = The Kinematics of Machinery Fig 2.jpg
 | width    = 250px
 | align    = right
 | cap      = Fig. 2.
 | capalign = left
}}


Fig. 2. On the left.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Image on right with above text

[সম্পাদনা কৰক]
{{Img float
 | style = 
 | above = Fig. 2
 | file     = The Kinematics of Machinery Fig 1.png
 | width    = 250px
 | align    = right
 | cap      = This is image of kinematics of machinery fig 1.
}}

Fig. 2

This is image of kinematics of machinery fig 1.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

{{Img float
 | file     = The Kinematics of Machinery Fig 2.jpg
 | width    = 250px
 | align    = center
 | cap      = Fig. 2.
}}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Fig. 2.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Image in centre without template
[সম্পাদনা কৰক]

Alternatively, don't use a template for this, just insert the image followed by the caption like this:

{{lorem ipsum}}
[[File:The Kinematics of Machinery Fig 1.png|center|250px]]
{{c|Fig.2}}

{{lorem ipsum}}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Fig.2

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Polygon shape outlines

[সম্পাদনা কৰক]

If the image is not a rectangle, and you want text to wrap closer to the image, use the polygon parameter. This parameter uses CSS polygon syntax: comma separated pairs of co-ordinates, either given in pixel values (e.g. 10px, 25px) or as a percentage (e.g. 20%, 50%).

Note: this sets the CSS shape-outside style, which overrides the margin-box for text-wrapping. This means if you set margins in the style parameter, they will be ignored if you also set polygon.

{{img float
|file=Select Popular Tales from the German of Musaeus (drop cap, page 1).jpg
|align=left
|width=300px
|polygon=0 0, 100% 0, 100% 34%, 60% 34%, 60% 58%, 36% 58%, 36% 100%, 0 100%
}}
{{lorem ipsum}}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Caution: divs break paragraphs and cause linter errors

[সম্পাদনা কৰক]

This template is a span-based template, which means it can "float" within a paragraph without breaking the surrounding text into two paragraphs.

However this means that you cannot use any div-based formatting within the cap field.

{{lorem ipsum}}
{{Img float
 | file     = The Kinematics of Machinery Fig 2.jpg
 | width    = 250px
 | cap      = {{smaller block|This is a div-based template and will break the paragraph where the template is inserted.}}
}}
'''Break!''' {{lorem ipsum}}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.


This is a div-based template and will break the paragraph where the template is inserted.

Break! Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.


  • {{Flow under}}: allows text to flow under parts of an image, similarly to using |polygon=
  • {{Overfloat image}}: performs reverse operation to this template, i.e. text is floated above an image element