WordPress.org

Support

Support » Themes and Templates » table cell text alignment

table cell text alignment

  • I’m trying to center-align text in table cells, and align=”center” only seems to work in a <p> tag, which adds an extra line that I don’t want. I’ve tried putting it in <span> tags instead, or in the table tags, and it just doesn’t take; the text is still left-aligned. Has anyone else had this problem?

    This is in (a child theme) of twenty eleven, if it matters.

Viewing 6 replies - 1 through 6 (of 6 total)
  • WPyogi

    @wpyogi

    Forum Moderator

    You need to use table styles — for cells, they have to be assigned to the td tags. See this for more details:

    http://www.w3schools.com/css/css_table.asp

    Thanks but I think I’m doing that. Doesn’t work in CSS and doesn’t even work in in-line HTML. If I write <td align=”center”>content</td> then the content is still left-aligned. Is there something wrong with that syntax?

    WPyogi

    @wpyogi

    Forum Moderator

    Yes read the page linked to.

    OK, so if I put

    td, th { text-align: center }

    in the CSS file, that seems to work. But <td text-align=”center”> in the post itself still has no effect. And I need to have some cells left-aligned and others center-aligned, so just one global setting isn’t enough. Any idea what’s going on?

    Ah ok, got it:

    <td style=”text-align:left”>

    thanks!

    Works for me: <td style=”text-align:left”>
    Thanks!!!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘table cell text alignment’ is closed to new replies.
Skip to toolbar