私は、動的に生成するテーブルを持っているようなシナリオを持っています。テーブルには、数値フィールドとテキスト フィールドが含まれる場合があります。そのテーブルに特定の CSS を与えます。text-align: center;
テーブルにテキスト フィールドがあり、テーブルに数値フィールドがある場所を指定したいのですが、 text-align: right;
単一の ID/クラスを使用して CSS を適用できますか? if condition
テーブルのフィールドが CSS ファイルの数値またはテキストであることを認識できますか?
これは動的に生成される私のテーブルです
<table class="alignCSS">
<thead>
<tr>
<th>
Doctor Name
</th>
<th>
Amount
</th>
</tr>
</thead>
<tbody>
<% foreach (var item in Model) { %>
<tr>
<td>
<%: Html.DisplayFor(modelItem => item.Doctor_Name) %>
// text field here i want to apply center alignment using CSS
</td>
<td>
<%: Html.DisplayFor(modelItem => item.Amount) %>
//number field here i want to apply right alignment using CSS
</td>
</tr>
<% } %>
</tbody>
</table>