Pergi ke kandungan

Templat:Imageontop

Daripada Wikibuku
{{{1}}} {{{3}}}
{{{2}}} {{{4}}}



Uses, Limitations, Parameters and Options

[sunting]

Uses

[sunting]

Template name:Imageontop

Makes a three celled table and automatically places the Table of Contents, (TOC), in it. Allows two separate images with captions to be placed to its right, level with the top of the TOC. Saves space and looks better than the large expanse of white space which usually exists to the right of the TOC.

Because the TOC text can vary and because the TOC has its own internal sizing algorithm, a widthleft option is provided to adjust the width of the leftmost cell, if necessary.

Note that the table can be placed anywhere on the page, so text could exist above it. To reduce any excessive gap between lead text and the template, consider placing it in-line with the end of the top text. Similarly, a follow-on heading might look spaced too much from the template; in this case use the HTML heading style and style it to remove padding. It could look like this:

<h3 style="padding-top:0px;">Heading Text</h3>


Limitations

[sunting]

I cannot figure out how to fully manage the mind of the TOC so the widthleft option was found necessary to unwrap TOC entries on occasion.

Images vary in size so it is important to select images of about the right shape before scaling. Scale the images to the same height if possible by specifying the height of each exactly and exaggerating the width to a considerable extent. In this way the software picks the least size to match the specification, which will be the one you want. Tiled Images contains further examples of such scaling, but see the code below for a typical example which can be run in the sandbox. (You will need to type a few dummy headings there to generate the Table of Contents.)

{{imageontop|[[Image:Narcissus pseudonarcissus (daffodills) - 1.jpg|900x230px]]|Caption 1|[[image:crocus_4.jpg|1000x230px]]|Caption 2}}


Provision for two images is made, but if captions are not needed, use template:textontop with images scaled and in-line within the text space. In this way, a variable number of images could be included.

Parameters

[sunting]

There are four parameters; use either the numbers or the names.

  • 1=Piccode1; the left image code space
  • 2=Caption1; the caption space for the left image
  • 3=Piccode2; the right image code space
  • 4=Caption2; the caption space for the right image

Options

[sunting]

widthleft
width of the leftmost table cell, with the Table of Contents, (TOC).Default 200px.