I have a simple table structure.
table > tbody > tr > td{
text-align:center;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta/css/bootstrap.css" rel="stylesheet"/>
<table class="table table-hover">
<thead>
<tr>
<td>Client</td>
</tr>
</thead>
<tbody>
<tr>
<td class="col-md-4">
C 1
</td>
</tr>
<tr>
<td class="col-md-4">
Client 2
</td>
</tr>
</tbody>
</table>
The question is : How can I align
td-s content left
and center
. ?
4
Answers
Try this:
If you can’t add extra
table-cells
you could usepadding
:If you are wanting the lower cells to be left justified from the centre, then just add padding-left 50% to your body cells
If you want them centred to the largest word, then left-aligned, you cannot have separate rows for the tbody, you would need to wrap all the words in an inline block div:
Try
colspan="<number of columns to merge>"
androwspan="<number of rows to merge>"
to merge row or column: