总的来说,我对MediaWiki、HTML、CSS和编程都是非常陌生的.我对if语句使用了ParserFunctions扩展,以便在其为空时删除行.当我使用该模板时,对于每删除两行,它会在顶部创建一个空白行.此外,"配偶"缩进的问题也让我很恼火,有什么方法可以改变这一点吗?
All rows All rows All rows Two rows removed 另请参阅以下内容:
{{#css:
.infobox {
width: 270px;
color: #000000;
line-height: 1.3;
}
.infobox td:nth-child(2) {
text-align: left;
}
.infobox td:nth-child(1) {
text-align: left;
font-weight: bold;
width: 30%;
max-width: 100px;
.infobox tr:first-child {
display: none;
}
}}
Html:
<div style="border: 1px solid #aaa; background-color: #F8F9FA; padding: 5px; text-align: center; font-size: 90%; float: right; margin: 0 0 10px 10px;">
{| class="infobox"
| <tr><th style="background-color: #99BADD; font-size: 120%; width: 30%; vertical-align: top;" colspan="2">{{{name}}}</th></tr>
| <tr><td colspan="2" style="text-align:center;"><img src="{{{image}}}" alt="{{{alt}}}" /></td></tr>
| <tr><th colspan="2" style="background-color: #CCBBEE;">{{{title}}}</th></tr>
{{#if: {{{birth|}}}
| <tr><td>Born</td><td>{{{birth}}}<br>{{{birth-place}}}</td></tr>
}}
{{#if: {{{death|}}}
| <tr><td>Died</td><td>{{{death}}}<br>{{{death-place}}}</td></tr>
}}
{{#if: {{{house|}}}
| <tr><td>House</td><td>{{{house}}}</td></tr>
}}
{{#if: {{{spouse|}}}
| <tr><td>Spouse(s)</td><td>{{{spouse}}}</td></tr>
}}
{{#if: {{{issue|}}}
| <tr><td>Issue</td><td>{{{issue}}}</td></tr>
}}
{{#if: {{{father|}}}
| <tr><td>Father</td><td>{{{father}}}</td></tr>
}}
{{#if: {{{mother|}}}
| <tr><td>Mother</td><td>{{{mother}}}</td></tr>
}}
</div>
我try 了一些css属性,但似乎都不起作用.