Parent links: Template:TOCnestright (edit talk links history)
This TOCnestright/doc template is used beside tall right located graphics structures like infoboxes
and is similar in purpose and use to {{TOCright}}. Unlike the latter, it does not hog the right margin as do so many page elements in this project, but instead shares the center upper space allowing text to wrap below and to the left, thus eliminating a lot of ugly white space on many pages while still keeping compliance with WP:MOS recommendations.

  • In addition, it allows an easy limitation ({{{maxwidth}}}) to be applied to the width of a TOC when a few section title lines are "overlong".
       (It is not recommended that wrapping be forced when the majority of lines are being wrapped, so check what you apply in several zoom in and zoom out settings—using [CTRL][+] and [CTRL][-] on most modern browsers. This is good practice when adding any graphic element to a page... for older readers tend to use larger effective fonts (and so zoom in), and younger readers — withbetter eye-sight!— most often use smaller fonts (or equivalently, zoom settings) (some of these 'types' (sic)... may even reach their fourties and experience the sad difference nature imposes themselves! But probably not! <G>) and of course, some people like wikipedia editors may bounce to and fro in between!
  • Experience and spot checks using seven different modern browsers suggest that the safest and surest course to avoid browser rendering order problems is to use {{FixHTML}} when this template is utilized. FixHTML boxes right floating elements and 'safes' them against various browser page rendering order differences. The {{FixHTML}} template was developed because of an old problem discussed in Wikipedia:How to fix bunched-up edit links, and merely formalizes the advice given in that old guideline in easy to use fashion, but uses the most reliable method of the several given (Those seven browsers used in testing again!).
  • It does take a number of optional formating arguments:
Structure control:    {{ before=| and/or ... prependinside= and appendinside=
                       and ... in closing ... after=| or {{{2}}}=|
Format (div style=):     "left=| margin=| otherstyle=| maxwidth=|"
count control:           limit=| or {{{1}}}=|
                      }} <!-- specify only 1 or limit, not both -->

prependinside and appendinside

संपादित करें
parameters {{{prependinside}}} and {{{appendinside}}} differ from {{{before}}} and {{{after}}}
as the later two are outside the control structure established by the controlling <div> ... </div> nested content. In practice,
   before=otherright floating element will present the TOC adjacent to the left side of the otherright floating element, such as an image or infobox.
   
  • prependinside=, will line up the TOC with the given element, both in a right floated column—in other words, the TOC will appear UNDER the other element, whereas with before, it appears to it's left and so more centered on a page.
       
    • It has a technical complication for image boxes because of the way they are rendered requiring a couple of extra minor steps.
      • prependwidth=define as inside image statement, in the below one would use: "prependinside=250px"
      • prependcaption=the image caption, in the below, if not obvious, don't edit here! Pleaase!!! <g>
      • in general, it is best and is easiest to use an inline comment, AND KEEP the old image link together:
             [[Image:Something.png|thumb|right|250px|This a picture...]] becomes instead:
             [[Image:Something.png<!--|thumb|right|250px|This a picture of the Rhine river taken at night.--></nowiki>]]</nowiki>
           
      • Put all together we get:
{{TOCnestright
 | prependinside=[[Image:Something.png<!--|thumb|right|250px|This a picture of the [[Rhine|Rhine river]] taken at night.'''-->]]
 | prependcaption=This a picture of the [[Rhine|Rhine river]] taken at night.
 | prependwidth=250px 
}}
  • If prependinside is not specified with one or the other of prependwidth or prependcaption, the template assumes you are a total ignorant fool and tries (and succeeds!) to display nothing at all. (Thus ensuring someone will read the above! <g>)
  • there are other prepend only in scope parameters that are purely optional, and adjust width, margins, padding and so forth (other common HTML box element parameters). These are probably uneeded,... well,... but just in case!
  • appendinside= puts the image lined up within the TOC box... ( example where-ever other HTML rendering locates that box element. It is thusly used for images primarily on history pages where there is a long tall infobox preventing images from appearing high up and one wants those, but do not want text to be sandwiched between floating HTML elements, as per the WP:MOS. This use presents nicely, and keeps all text left, but allows small images to be beside of infoboxes, just like the TOCnestright floats on pages using no frills.
The |otherstyle= parameter is for any element not controlled currently by the style line as listed below. It might be used for example to define a color, a line-height, or other such HTML parameter.


Actual code...
{{{1|}}}<!-- specify only 1 or limit, not both -->{{{before|}}}<div style="float:{{#if:{{{left|}}}|left;|right;}}<!--
--> margin: {{{margin|1em 0 1em 1.5em}}}; <!--
-->{{{otherstyle|}}};{{#if:{{{maxwidth|}}}|max-width:{{{maxwidth}}};}}"<!--
--> {{#if:{{{1|}}}{{{limit|}}}|class="toclimit-{{{1|{{{limit|}}}}}}"}}> <!--

-->{{#if:{{{prependinside|}}}<!--
-- " -->|{{#if:{{{prependcaption|}}}{{{prependwidth|}}}<!--
-- "--   " -->|<table style="border:1px solid black; width:{{{prependwidth|250px}}}; <!--
-- "     "      -->{{#if:{{{maxwidth|}}}|max-width:{{{maxwidth}}}; <!--
-- "     "      -->}} padding:{{{prependpadding|.25em}}}; margin:{{{prependmargin|0 0 0 .25em}}}; "><tr<!--
-- "--   " -->><td>{{{prependinside|}}}<br></td></tr<!--
-- "--   " -->><tr><td>{{{prependcaption|"prependcaption"}}}</td></tr<!--
-- "--   " -->></table><br/><br/><!--
-- "  -->}}<!--
-->}}  <!--
-->__TOC__ <!--
-->{{#if:{{{appendinside|}}}|<br/>{{{appendinside|}}}}}
</div><!--
-->{{{after|}}}{{{2|}}}<!--
-->
Tips
  • |left= is only used inside a table element, to place the TOC, under a page's first image. It looks a little better used that way.
  • The most useful format parameter is maxwidth. Setting between 180-220px usually does a nice job of wrapping long section titles within the displayed TOC for the most likely viewing zoom-in/zoom-out settings used by a typical viewer.
  • prependinside= allows another structure to float part-right ABOVE the TOC as well, such as a small image.
  • appendinside= allows another structure to float part-right below the TOC as well, such as a small image.
Tech note...
  • HTML renders in differing order on different browsers, so it is advisable to use the template {{FixHTML}} in conjunction with this template around any right floating elements. This tablizes such and the behavior has been tested satisfactorily against most modern browsers from MacIntosh computers to Unix, and no less than three generations of the troublesome Internet Explorers (IE5, IE6, and IE7), all work satisfactory when the two templates are used together in mutual support.

See also
template:TOCright/doc