【问题标题】:Mediawiki Template optionsMediawiki 模板选项
【发布时间】:2015-12-16 22:39:17
【问题描述】:

我有我的模板,并且在大多数情况下它确实有效,但有两件事是错误的。我希望进度条在页面左侧对齐,并且我还希望显示百分比。

<div style="
width:{{{width|25%}}};
{{#ifeq: {{{center|yes}}} | yes |
margin:auto;
text-align:center;}}">
{{#ifeq: {{{header|yes}}} | yes
| <p>
{{{text|completed <small>(estimate)</small>}}}
</p>
}}
<p style="border:{{{border|1px solid gray}}}; padding:{{{padding|1px}}};    overflow:hidden;">
<span style="
width: {{#expr: {{{1|<noinclude>2</noinclude>0}}} / {{{total|100}}} *   100}}%;
height: {{{height|2}}}px;
background:{{{color1|#5FDB00}}};
float:left;">&nbsp;</span>
<span style="
 width:{{#expr: 100 - {{{1|<noinclude>2</noinclude>0}}} / {{{total|100}}}    * 100}}%;
 height:{{{height|2}}}px;
 background:{{{color2|#efefef}}};
 float:left;
 ">&nbsp;</span>
 </p>
 </div>

我的例子

 {{Progress bar|90|text=KTG Image Rebuild}}

在此示例中,任务已完成 90%,但未显示在进度条上或上方。

【问题讨论】:

  • 包含来自此的 HTML 输出可能会有所帮助。您希望“90%”出现在哪里?
  • 我贴的是模板代码。我在想我需要为进度条添加另一个选项,或者以某种方式使用 CSS
  • 但是生成的 HTML 是什么样的?
  • 我想要带有文本= 的进度条,然后是它旁边或进度条中间的百分比。

标签: mediawiki mediawiki-templates


【解决方案1】:

试试这个。您实际上并没有尝试将进度文本放入其中,不确定您为什么希望它在那里。它在进度条&lt;p&gt;上方添加为div。

<div style="float:left; width:{{{width|25%}}}; {{#ifeq: {{{center|yes}}} | yes | margin:auto; text-align:center;}}">
{{#ifeq: {{{header|yes}}} | yes | <p>
{{{text|completed <small>(estimate)</small>}}}
</p>
}}
<div style="float:right; text-align:right; font-size:10px; line-height:10px;">{{{1|20}}}%</div>
<p style="border:{{{border|1px solid gray}}}; padding:{{{padding|1px}}}; overflow:hidden; float:left; width:80%">
<span style="width:{{#expr: {{{1|20}}} / {{{total|100}}} * 100}}%; height:{{{height|2}}}px; background:{{{color1|#5FDB00}}}; float:left;">&nbsp;</span>
<span style="width:{{#expr: 100 - {{{1|20}}} / {{{total|100}}} * 100}}%; height:{{{height|2}}}px; background:{{{color2|#efefef}}}; float:left;">&nbsp;</span>
</p>
</div>

【讨论】:

    猜你喜欢
    • 2011-06-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多