html - Need to span my <td> across several rows, not working, using Razor syntax -
here's code (look says rowspan="6"
- not working:
<table> <thead> <tr> <td>ingredient</td> <td>qty (gm)</td> <td>% of capsule</td> </tr> </thead> @foreach (var in model) { if (convert.todecimal(i.qty) < 0) { <tr> <td style="border: 1px solid red; color: red;">@i.ingredient</td> <td style="border: 1px solid red; color: red;">@i.qty</td> </tr> } else if (convert.todecimal(i.qty) == 0m) { continue; } else { if (i.ingredient.contains("active")) { <tr> <td>@i.ingredient<br /> <input type="text" name="@i.ingredient" id="@i.ingredient" /></td> <td>@i.qty</td> @if (i.percent != 0m) { <td rowspan="6" style="text-align: center;">@i.percent.tostring("#.##")</td> } </tr> } else { <tr> <td>@i.ingredient</td> <td>@i.qty</td> @if (i.percent != 0m) { <td style="text-align: center;">@i.percent.tostring("#.##")</td> } else { <td></td> } </tr> } } } <tr> <td></td> <td>total %:</td> <td style="text-align: center;">@model.sum(j => j.percent).tostring("#.##")</td> </tr> </table>
which produces:
i need align cell contains 9.74 center of 6 rows, indicated in screenshot red arrows. doing wrong?
the rowspan working fine. value needs vertically aligned,
<td rowspan="6" style="vertical-align:center; text-align:center;">
let me know if helps.
Comments
Post a Comment