如何使文本与数据表右对齐


<table id="table-DataView-Ceft-History" class="table table-bordered v-table">
<thead>
<tr>
<th style="width:auto;">Date</th>
<th style="width:auto;">MBSL Account No</th>
<th style="width:auto;">Reference No</th>
<th style="width:auto;">Amount(LKR)</th>
<th style="width:auto;">Reason</th>
<th style="width:auto;">Third Party Acc No</th>
<th style="width:auto;">Transfer status</th>
<th style="width:auto;">Target Bank</th>
<th style="width:auto;">Transfer By</th>
</tr>
</thead>
</table>

使用jQuery,可以通过css方法完成

$('#table-DataView-Ceft-History thead th').css('text-align', 'right');

或者,我们可以使用 css 属性text-align: right;th标签中的文本右对齐

th {
text-align: right;
}
<table id="table-DataView-Ceft-History" class="table table-bordered v-table">
<thead>
<tr>
<th style="width:auto;">Date</th>
<th style="width:auto;">MBSL Account No</th>
<th style="width:auto;">Reference No</th>
<th style="width:auto;">Amount(LKR)</th>
<th style="width:auto;">Reason</th>
<th style="width:auto;">Third Party Acc No</th>
<th style="width:auto;">Transfer status</th>
<th style="width:auto;">Target Bank</th>
<th style="width:auto;">Transfer By</th>
</tr>
</thead>
</table>

最新更新