[Resolved] Align Table Text to Center

Home Forums Support Align Table Text to Center

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1315043
    Hendry

    Hello, i am having trouble in aligning my custom html table text to be centered.

    i tried this css:
    table,th,td,caption{text-align:center}

    but it makes my table text that i create with wordpress table element become centered also.

    is there any css can i use so only my the table with class element aligned center?

    #1315362
    David
    Staff
    Customer Support

    Hi there,

    you can add a class to your HTML and target that eg.

    <table class="custom-table">
    <!-- Rest of table code -->
    </table>

    then you should be able to target that class:

    .custom-table {
        text-align: center;
    }
    #1315383
    Hendry

    i tried this code before with class .dounkey-table-center, but it still does not work

    #1315437
    David
    Staff
    Customer Support

    Try this:

    table.dounkey-table-center,
    table.dounkey-table-center th,
    table.dounkey-table-center td,
    table.dounkey-table-center caption {
        text-align: center;
    }
    #1315512
    Hendry

    Thank you, it works

    #1315534
    David
    Staff
    Customer Support
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.