我正在尝试在Colspan
中的每一列上方添加文本,但没有按预期工作。https://i.stack.imgur.com/MxQPj.png如我希望colspan
列中的图像所示1 2 3 4 5 O,但我不知道怎么做。这是我的代码的例子
<thead>
<tr>
<th width="30%">
@DbResHtml.T("Натпреварувач", "Resources")
</th>
<th width="1%">
@DbResHtml.T("Бр.", "Resources")
</th>
<th width="1%">@DbResHtml.T("ВИ", "Resources")</th>
<th width="1%">
@DbResHtml.T("П.", "Resources")
</th>
<th colspan="6" scope="colgroup">
@DbResHtml.T("Грешки", "Resources")<br>
@DbResHtml.T("12345O", "Resources")
</th>
</tr>
</thead>
为清楚起见,未包含Tbody
代码。
我不确定我是否正确地回答了你的问题,但如果你想在每列上方都有文本,colspan会阻止它正常工作。您需要将它们拆分为自己的元素。
<thead>
<tr>
<th width="30%">
@DbResHtml.T("Натпреварувач", "Resources")
</th>
<th width="1%">
@DbResHtml.T("Бр.", "Resources")
</th>
<th width="1%">@DbResHtml.T("ВИ", "Resources")</th>
<th width="1%">
@DbResHtml.T("П.", "Resources")
</th>
<th>@DbResHtml.T("Г", "Resources") <br>
@DbResHtml.T("1", "Resources")
</th>
<th>@DbResHtml.T("р", "Resources")<br>
@DbResHtml.T("2", "Resources")</th>
<th>@DbResHtml.T("е", "Resources")<br>
@DbResHtml.T("3", "Resources")</th>
<th>@DbResHtml.T("ш", "Resources")<br>
@DbResHtml.T("4", "Resources")</th>
<th>@DbResHtml.T("к", "Resources")<br>
@DbResHtml.T("5", "Resources")</th>
<th>@DbResHtml.T("и", "Resources")<br>
@DbResHtml.T("O", "Resources")</th>
</tr>
</thead>
如图所示,您正在从Db中提取字符串,以便将字符串拆分为数组,并执行循环为数组中的每个字符生成每个字符串。
希望这能有所帮助。