Template:TTip

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. And so we conclude with some other test words to show the inline behavior of the template when applied within text lacking a trailing space:Tip: This is a sample tip that might be passed to this template! If you want a different message lead word' before the colon,
define '''| pre=''' to change the word to one more suitable to your page's context.
Note also how there is no padding after nor does it cause a newline! Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. So we can fake this text as well, showing how we imbedded a break to cause a linefeed just where we wanted! Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Template documentation[edit] [history] [purge]

  This template 'TTip' (TrainzTip inline) is adapted from {{LeftBox}} but skips the box class statement and uses a span to wrap the text. It is meant for short tips or points.

Below, the template with typesetters test text:

  • Adapted from {{TextBox}} for more user friendly style and inline notations.

 

usage
  • The template call is normally {{LeftBox|'your text'}}, where the first placeholder parameter (same as: |1= your text) is the normal text entry mode when calling the template.
  • Normal mode is {{TTip | your text goes here }}.
  • Alternatively the 1= or |2= and |3= placeholder parameters are also active. These can be used to wrap a text element with for example, a 1=<div style="background:white;"> and 3=</div> so you might use an expanded call layout for clarity:

{{LeftBox
  |<div style="background:white;">     or  |1=<div style="background:white;"> 
  |''your text goes here''             or  |text=''your text goes here''
  |</div>                              or  |3=</div>      
}}

The actual pass argument evaluated is:

{{{1|}}}{{{text|{{{2|}}}}}}{{{3|}}}
where |text=''your text'' has precedence over the evaluation of any {{{2}}} pass parameter.
Pragmatic note:
In general
parsing template text containing the equals sign: '=' and some other wikimarkup language operator characters (punctuation characters) need to have an explicit parameter to work properly. In such text, for example, the work around template '{{!}}' may be needed to display any pipe character ('|') needed as well, while the exclamation point works normally.
This text inside LeftBox with |small=1 using the |3='this text line' mode.

  Other Parameters:

The following is the actual styling code, and parameters should be obvious
style="clear:{{{clr|{{{clear|all}}}}}}; max-width:{{{MW|1440px}}};width:{{{W|90%}}}; <!--
--> font-family:{{#if:{{{family|{{{FFAM|}}}}}}|{{{family|{{{FFAM|}}}}}}; |Garamond, Georgia, Times New Roman, Serif}};<!-- 
-->font-face: {{#if:{{{face|{{{FF|}}}}}}|{{{face|{{{FF|}}}}}}; |Garamond}};<!--
--> {{#if:{{{font-size|{{{FS|}}}}}}|font-size:{{{font-size|{{{FS|}}}}}}; |}}<!--
--> {{#if:{{{line-height|{{{LH|}}}}}}|line-height:{{{LH|{{{line-height|}}}}}}; |}}<!--
--> background:{{{BG|#fafafa}}}; color:{{{CO|#000000}}}<!--
-->margin:{{{M|{{{MT|5px}}} {{{MR|auto}}} {{{MB|5px}}} {{{ML|2px}}}}}}; <!--
-->padding:{{{P|{{{PT|2px}}} {{{PR|0}}} {{{PB|2px}}} {{{PL|0px}}}}}}; ">
The parameters in order of likely formatting fiddles
  • The | BG= option may be given to specify a different background color.
  • The | W= option may be given to adjust the width from default 90%.
  • The | MW= option may be given to adjust the max-width from 1440px. Specify MW=auto to allow the box to go margin to margin.
  • The | P= option may be given to change the padding from 0px 25px; s.a. a more space economical 'P=0 8px 0 1.2em;' or the like.
  • The | VA= option may be given to change HTML/CSS vertical-align:middle to bottom or top for text. The default is 'middle'.
  • The | BVA= option may be given to change HTML/CSS vertical-align:top to middle or bottom for the entire textbox. The default is 'top' so it floats up against other elements.
  • See | IVA= option below for images vertical-alignments.
  • The | clr= or |clear= options may be given to change the clearance to left or right so to float the template beside other table elements.
  • Default is 'left' so this template box will nest under any left elements
  • and float beside right hand elements such as images or right margin navigation text boxes.
  • Text may then flow around the elements and wrap in between Left and Right elements on a page frame. (Look at the left side of any Wikimedia page--most of the page is right floated beside it.)
Parameters with inheritance

 

  • The template now defaults to Serif font families, as being less often found on web pages, the contrast should emphasize your message. '|FF=' selects a specific font face, <font-color=blue>provided your user has it on his or her browser.
  • 'FFAM' or 'family' can be used to change the default Font-Family declaration.
  • 'LH or 'line-height' to scrunch lines closer and make the output more compact.

 


  • Individual margin and padding parameters are top, right, bottom, left respectively:
Individual margin settings: 'MT', 'MR', 'MB', and 'ML' and padding's: 'PT', 'PR', 'PB', and 'PL' respectively.
  • however, the definitions of 'margin' and 'M' have precedence and setting inside parameters will be moot if either is defined.
  • also, the definitions of 'padding' and 'P' will have precedence and setting inside parameters will be moot if either is defined.

 


Image options
  • image (optional) : the image to be used.
  • The | size= option may be given to override the default 25x25px size.
  • The | IVA= option may be given to change HTML/CSS vertical-align:top to middle or bottom for the image in it's leftside box. The default is 'top' so it floats up against the overall padding of the surrounding box.
See also these Trainz templates