• Resolved oceanw

    (@oceanw)


    Hello, kindly advise how to put an image in the center. Now I already align the image to the center under wpDataTables but it is always aligned to the left in the post. Thanks in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author wpDataTables

    (@wpdatatables)

    Hello.
    Apologies for the late reply.
    It depends which table type are you using, a Simple Table,
    or Table linked to a data source, such as CSV/Excel. ( Simple Tables have different CSS classes)

    ?1. For example, if i have a table from?Excel or CSV ( or other data source) like this :

    And if i want to center these images in the “Profile picture” column.

    First we add a custom CSS class in the Column settings/Display tab :

    ?After that, you can add this CSS in order to force centering of the images in all cells of this column :

    .centerimage {
    text-align: center !important;
    }

    In this example i named the class “centerimage”, but you can name it anything else.

    Then add this in the main plugin settings/Custom JS and CSS/Custom CSS :

    This is the result :?

    Let us know if that helped.

    – For Simple Tables, if you need all your images in all tables to be centered, by default all images should already be centered, but you can use this CSS selector for all images in Simple tables :

     .wpDataTableContainerSimpleTable .wpdtSimpleTable td img {
        max-width: 100%;
        height: auto;
        margin: 0 auto !important;
    }

    Let us know if you encounter any additional issues with this.

    Thanks.

    Thread Starter oceanw

    (@oceanw)

    It works. Really appreciate it.

    Plugin Author wpDataTables

    (@wpdatatables)

    Hello.
    We are happy to see that this achieves the desired result.
    Please don’t hesitate to open a new Post if anything else comes up that we might assist with.
    Kind regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Put image in the center’ is closed to new replies.