Template:Section: Difference between revisions

From Elwiki
mNo edit summary
m (Undo revision 181920 by Boxsnake (talk))
Line 1: Line 1:
<includeonly><table cellspacing="0" cellpadding="0" style="width:{{{Widths|100%}}}; padding: 0; margin: 0; font-size: 1em; line-height: 1.5em; word-break: break-all; border: 1px #000 solid; border-bottom: none; border-sapcing: 0;{{{SectionSty|}}}" {{{Attr|}}}>
<includeonly><table cellspacing="0" cellpadding="0" style="width:{{{Widths|100%}}}; padding: 0; margin: 0; font-size: 1em; line-height: 1.5em; word-break: break-all; border: 1px #000 solid; border-bottom: none; border-sapcing: 0;{{{SectionSty|}}}" {{{Attr|}}}>
   <tr style="width: 100%; font-weight: bold; color: #fff; text-align: center; vertical-align: middle; text-shadow: 1px 1px 1px black; height: 2em;{{{TitleStys|}}}">{{#if:{{{Title0|}}}|<th style="width:{{{Width0|{{{Width|}}}}}}; border-left: 1px #000 solid; border-bottom: 1px #000 solid; background-color:{{{Color0|{{{Color|}}}}}}; background-image: linear-gradient(to bottom, #eee, {{{Color0|{{{Color|}}}}}});{{{TitleSty|}}};{{{TitleSty0|}}}" {{{Attr0|}}}>{{{Title0|}}}</th>|}}{{#for:20|<th style="width:{{{Width$n$|{{{Width|}}}}}}; border-left: 1px #000 solid; border-bottom: 1px #000 solid; background-color:{{{Color$n$|{{{Color|}}}}}}; background-image: linear-gradient(to bottom, #eee, {{{Color$n$|{{{Color|}}}}}});{{{TitleSty|}}};{{{TitleSty$n$|}}}" {{{Attr$n$|}}}>{{{Title$n$|}}}</th>}}</tr>
   <tr style="width: 100%; font-weight: bold; color: #fff; text-align: center; vertical-align: middle; text-shadow: 1px 1px 1px black; height: 2em;{{{TitleStys|}}}">{{#forargs:Title
   <tr style="width: 100%; vertical-align: top;{{{Styles|}}}">{{#if:{{{Title0|}}}|<td style="padding: 0.5em;{{{Style|}}};{{{Style0|}}}">{{{Content0|}}}</td>|}}{{#for:20|<td style="padding: 0.5em;{{{Style|}}};{{{Style$n$|}}}">{{{Content$n$|}}}</td>}}</tr>
| key
| value
| <nowiki/>
{{#if:{{Isnumeric|{{#var:key|}}}}
|
<th style="width:{{{Width{{#var:key|}}|{{{Width|}}}}}}; {{#ifeq:{{#var:key|}}|0||border-left: 1px #000 solid;}}border-bottom: 1px #000 solid; background-color:{{{Color{{#var:key|}}|{{{Color|}}}}}}; background-image: linear-gradient(to bottom, #eee, {{{Color{{#var:key|}}|{{{Color|}}}}}});{{{TitleSty|}}};{{{TitleSty{{#var:key|}}|}}}" {{{Attr{{#var:key|}}|}}}>{{#var:value|}}</th>
}}}}</tr>
   <tr style="width: 100%; vertical-align: top;{{{Styles|}}}">{{#forargs:Title
| key
| value
| <nowiki/>
{{#if:{{Isnumeric|{{#var:key|}}}}
|
<td style="padding: 0.5em;{{{Style|}}};{{{Style{{#var:key|}}|}}}">{{{Content{{#var:key|}}|}}}</td>
}}}}</tr>
</table></includeonly><noinclude>{{DISPLAYTITLE:Section模板}}
</table></includeonly><noinclude>{{DISPLAYTITLE:Section模板}}
{{Section
{{Section

Revision as of 09:58, 10 September 2014

Section模板
Section模板是由boxsnake编写的UI模板,旨在美化界面。此页即为Section模板示例。
模板参数
  1. 模板参数即传入模板的变量,一般为参数名=参数值{{模板名 | 参数名1=参数值1 | 参数名2=参数值2}}或者参数值{{模板名 | 参数值1 | 参数值2}})。
  2. 后者方式传入的参数,模板用{{{参数序号}}}{{{1}}})调用。前者既可以用{{{参数序号}}}调用,也可以用{{{参数名}}}{{{param}}})调用。
参数
{{
  1. Section模板最多可以有16列,从左到右编号从0到15。
  2. 整体参数:对整个区域进行的设置。
  3. 全局参数:对整个区域内每个元素进行的设置,会覆盖相同的整体参数设置。
  4. 局部参数:对单个元素进行的设置,会覆盖相同的整体参数和局部参数设置。
名称 描述
整体参数:
SectionSty
Section模板整体样式(兼容CSS语法)。
整体参数:
TitleStys
标题栏整体样式(兼容CSS语法),会覆盖相同的SectionSty设置。
整体参数:
Styles
内容区整体样式(兼容CSS语法),会覆盖相同的SectionSty设置。
整体参数:
Widths
整个Section模板额宽度(兼容CSS语法),可以使用em,pt,百分比等,此后不需要分号,如果不指定即为100%。
整体参数:
Attr
整个Section模板的属性附加(兼容HTML语法),如class等属性。
全局参数:
TitleSty
标题栏样式,类似TitleStys,但是此样式设置是针对标题栏中的每个标题进行的设置,而非整个标题栏。此样式设置会覆盖SectionStyTitleStys的相同设置。
全局参数:
Style
内容区样式,类似Styles,但是此样式设置是针对内容区中的每个元素进行设置,而非整个内容区。此样式设置会覆盖SectionStysTitleStys的相同设置。
全局参数:
Color
标题栏颜色(兼容CSS语法),可以使用rgba,#XXXXXX和颜色名称,此后不需要分号。此样式设置会覆盖SectionSty的颜色设置,但是会被TitleStysTitleSty中的颜色设置覆盖。
全局参数:
Width
列宽度(兼容CSS语法),可以使用em,pt,百分比等,此后不需要分号。此样式设置会覆盖SectionSty的颜色设置,但是会被TitleStysTitleSty中的宽度设置覆盖。
  • 注:每一列的宽度是由标题栏宽度决定的,所以如果隐藏了标题栏,请设置内容区宽度。
局部参数:
TitleSty0 ... TitleSty15
0-15列标题栏样式(兼容CSS语法),会覆盖SectionStyTitleStysTitleSty的对应设置,同时会覆盖ColorColor0 ... Color15WidthWidth0 ... Width15的颜色和宽度设置。
局部参数:
Style0 ... Style15
0-15列内容区样式(兼容CSS语法),会覆盖SectionStyStylesStyle的对应设置。
局部参数:
Attr0 ... Attr15
0-15列标题栏附加属性(兼容HTML语法),可以设置如colspan、rowspan之类的附加属性。
局部参数:
Title0 ... Title15
0-15列标题栏内容。
局部参数:
Content0 ... Content15
0-15列内容区内容。
  • 注:如果要在内容区添加表格或其他区域内容,请使用<span> ... </span><span style="display:none">{{</span> ... <span style="display:none">}}</span>(后者可约束MediaWiki语法表格)。
}}
其他注意事项和提示
  1. 为了和上下的Section模板结合,Section模板默认是没有底部边框的,因此在需要的时候用SectionSty设置。
  2. 为了和左边的Section列结合,从第一列开始的列标题均有左边框,如果需要将非0列作为最左侧列,请用TitleStyN将对应列表标题的左边框去除。
  3. 标题栏下的横线为标题栏元素属性,而非标题栏整体属性。
其他示例
示例1
示例1
{{Section
| SectionSty=border: 2px #ccc solid; border-radius: 5px;
| Color0=lightblue
| Title0=示例1
| Content0=示例1
}}