Template:Su: Difference between revisions
From Vigyanwiki
Template>Headbomb (no reason to override userpreferences, no reason to display {{{p| gH}} or whatever that means, the documentation covers this) |
Template>Headbomb (return to previous behaviour, <sup> and <sub> tags for the "common cases" has less chance of breaking on older browsers) |
||
Line 1: | Line 1: | ||
<span style="{{#ifeq:{{{w|}}}|f|font-family:monospace;}}font-size:{{{fontsize| | {{#if:{{{p|}}} | ||
|{{#if:{{{b|}}} | |||
|<span style="{{#ifeq:{{{w|}}}|f|font-family:monospace;}}font-size:{{{fontsize|80%}}};overflow:visible;display:inline-block; vertical-align:-0.4em; line-height:1.1em; margin-bottom:-0.2em;background:transparent;text-align:{{#switch:{{{a|}}}|r=right|c=center|left}}">{{{p|{{{p}}}}}}<br />{{{b|{{{b}}}}}}</span> | |||
}}">{{{p|}}}<br />{{{b|}}}</span><noinclude><!-- | |<sup>{{{p|}}}</sup> | ||
}} | |||
|<sub>{{{b|}}}</sub> | |||
}}<noinclude><!--endif {p} passed | |||
-------------------------------------------------------------- | -------------------------------------------------------------- | ||
--NOTES: | --NOTES: | ||
Line 12: | Line 15: | ||
-- Usage: {{su | p=super | b=sub}} | -- Usage: {{su | p=super | b=sub}} | ||
-- | -- | ||
-- NOTE C2: For | -- NOTE C2: For compatibility with browser MS IE6, the result | ||
-- | -- with both subscripts is a span with vertical "<br />" | ||
-- to align the superscript & subscript together. | -- to align the superscript & subscript together. | ||
-- | -- | ||
-- NOTE F3: The font can be changed by w=f to select the | -- NOTE F3: The font can be changed by w=f to select the | ||
-- font-family:monospace, or by fontsize=nn% (default: | -- font-family:monospace, or by fontsize=nn% (default: | ||
-- | -- 80%) where 100% is the usual super/subscript size. | ||
-- | -- | ||
-- NOTE IE: Because IE6 often handles only 1 style="..." and | -- NOTE IE: Because IE6 often handles only 1 style="..." and | ||
Line 24: | Line 27: | ||
-- are combined as 1 <span> when {p}/{b} are both shown. | -- are combined as 1 <span> when {p}/{b} are both shown. | ||
-- | -- | ||
-- NOTE | -- NOTE L5: The logic to select the typesetting, is shown by | ||
-- | -- the following 2 nested if-then-else statements: | ||
-- | -- | ||
-- | -- IF superscript {p} exists | ||
-- THEN IF subscript {b} exists | |||
-- THEN show both aligned {p}<br>{b} | |||
-- ELSE show superscript {p|} ENDIF | |||
-- ELSE show subscript {b|} ENDIF | |||
-- | -- | ||
-------------------------------------------------------------- | -------------------------------------------------------------- | ||
Line 40: | Line 47: | ||
--21Dec10 Used 1 <span> when both {p}/{b} for IE6 text-align. | --21Dec10 Used 1 <span> when both {p}/{b} for IE6 text-align. | ||
--21Dec10 Lowered {p} "line-height:1.1em" for Konqueror 3.5.8. | --21Dec10 Lowered {p} "line-height:1.1em" for Konqueror 3.5.8. | ||
-- | --21Dec10 To avoid extra HTML, cut duplicate "line-height:1". | ||
-- | -- | ||
-->{{documentation}}<!-- | -->{{documentation}}<!-- | ||
-- PLEASE ADD CATEGORIES & INTERWIKIS TO /doc SUBPAGE - NOT HERE. | -- PLEASE ADD CATEGORIES & INTERWIKIS TO /doc SUBPAGE - NOT HERE. | ||
--></noinclude> | --></noinclude> |
Revision as of 16:10, 22 December 2010
Template documentation
[create]