Search code examples
htmlcssalignment

HTML Align text center at the same line


I was trying to align my text in my table and I'm wondering how do this.

My code:

<table class="n">
<tbody>
<tr>
<td style="text-align:center"><strong>TITLE</strong></td>
<td style="text-align:center"><strong>TITLE</strong></td>

</tr>
<tr>
<td style="text-align:center">A</td>
<td style="text-align:center"><strong>MESSAGE TEST</strong></td>
</tr>
<tr class="alt">
<td style="text-align:center">C</td>
<td style="text-align:center"><strong>message test lasdadlong</strong></td>

</tr

Fiddle

is there anyway of edit the text so everything start at the same line ?

Desired output:

enter image description here


Solution

  • <center><table class="n">
    <tbody>
    <tr>
    <td style="text-align:center"><strong>TITLE</strong></td>
    </tr>
    <tr>
    <td style="text-align:center"><strong>MESSAGE TEST</strong></td>
    </tr>
    <tr class="alt">
    <td style="text-align:center"><strong>message test lasdadlong</strong></td>
    </tr></center>

    I have edited your code as your mentioned image, Post again edited to stable table on center. Hope it works for you.