Text alignment not working inside table

Posted in: Newspaper
Post count: 45

Hi,

I’m using the following code to insert a table into a post.

<style>
table, th {
border: 2px solid black;
width:60px;
}
table {
border-collapse: collapse;
width: 700px;
margin: auto;
}

th {
height: 30px;
}
</style>

<table>
<tbody>
<tr>
<th colspan=”2″>How You Spend Your ‘Day'</th>
</tr>
<tr>
<th>Time of Day</th>
<th>Activity</th>
</tr>
<tr>
<th>-</th>
<th>-</th>
</tr>
<tr>
<th>-</th>
<th>-</th>
</tr><tr>
<th>-</th>
<th>-</th>
</tr><tr>
<th>-</th>
<th>-</th>
</tr><tr>
<th>-</th>
<th>-</th>
</tr><tr>
<th>-</th>
<th>-</th>
</tr><tr>
<th>-</th>
<th>-</th>
</tr><tr>
<th>-</th>
<th>-</th>
</tr><tr>
<th>-</th>
<th>-</th>
</tr><tr>
<th>-</th>
<th>-</th>
</tr><tr>
<th>-</th>
<th>-</th>
</tr><tr>
<th>-</th>
<th>-</th>
</tr>
</tbody>
</table>

When I run it in chrome locally, it works fine, all content written inside a <th></th> tag are center-align. But when I use this code into my post, the problem appears with text-alignment. The text moved to left side. As, all the contents written inside <th></th> tag are center-align, and it showing a good result when I run this code into chrome locally. So why a problem is appearing when I use it into the post.

However, I use text-align command but nothing going to work properly.

Please tell me how to solve that issue. You can see the table here. http://www.tycoonzfitness.com/overweight-causes-solution/

Post count: 9544

maybe try

th {
height: 30px;
text-align:center;
}

?

Post count: 45

I’ve also tried but an issue still unresolved. Nothing is going to change. Please tell me how to do this?

Post count: 20688

Hi,

You can try the code provided below, with this result – https://www.screencast.com/t/FbS2S7d1Q9kb
The code must be entered in Theme panel->Custom css

table th {
text-align: center;
}

Thanks

Viewing 4 posts - 1 through 4 (of 4 total)
The forum ‘Newspaper’ is closed to new topics and replies.