Image alignment
-
Images cannot be aligned to the center of the cell.
Inserting HTML does not help
The page I need help with: [log in to see the link]
-
Hello,
We are not able to reproduce this issue if we use the Simple Table’s ‘insert media’ tool in the back-end editor.
Here is a screenshot; it will automatically center the image in the cell by default :And here is how it will look in the Desktop table version on the front end :
Now, in your table cell, it seems you wrote the Custom HTML manually and made a DIV with a paragraph inside and then the img tag inside it.
We tried the same, and we still can’t reproduce any issue with the image alignment.
On our tables, the images are still centered.
Here is the HTML code we tried in the cell :<div>
<p><img src="http://localhost/current/wp-content/uploads/2025/04/Sunny-80x80-1.png"/></p>
</div>And screenshots how the image renders, centered by default ( we tried with or without the CSS “text-align center” and it works the same).
Can you please check how the table looks in the back end preview?
If the table loads the images centered on the back-end preview version, and this issue only happens on front-end, that means your Theme is probably overriding our default CSS/styles.
Try changing your Theme to any other and refresh the Page.In any case, you can ‘force’ these images in our table cells to be centered via this CSS code :
#wpdtSimpleTable-4 td img {
display: block !important;
margin-left: auto;
margin-right: auto;
}This CSS focuses only this table ID 4 from the Page.
Add this to the Main Plugin settings/Custom JS and CSS/Custom CSS.
If you wish to do one piece of code, which will align all images in all your Simple tables to center, you can remove the Table ID, and use this code instead :.wpdt-c.wpDataTableContainerSimpleTable .wpdtSimpleTable td img {
display: block !important;
margin-left: auto;
margin-right: auto;
}
I hope that helps.
Kind regardsThank you for your reply.
Preview and page on site are there:
https://school.dmitrd.h1n.ru/errorsHello,
Apologies for such long waiting time on this reply.
Thank you for your patience.
As far as we can see, in the back-end preview, all the images are centered.
And only on the front-end version, it is aligned to the left.
That means that something else on your Site, like your current Theme perhaps, is overriding our table’s default styles.
To isolate this, please change to any other WP Theme and refresh the Page, see if that solves it?
If so – This confirms what we suspected.
If you have to use this Theme, you can use the CSS fix we suggested above. We will copy it again :Try changing your Theme to any other and refresh the Page.
In any case, you can ‘force’ these images in our table cells to be centered via this CSS code :
#wpdtSimpleTable-4 td img {
display: block !important;
margin-left: auto;
margin-right: auto;
}This CSS focuses only this table ID 4 from the Page.
Add this to the Main Plugin settings/Custom JS and CSS/Custom CSS.
If you wish to do one piece of code, which will align all images in all your Simple tables to center, you can remove the Table ID, and use this code instead :.wpdt-c.wpDataTableContainerSimpleTable .wpdtSimpleTable td img {
display: block !important;
margin-left: auto;
margin-right: auto;
}Kind regards,
Milos-
This reply was modified 1 year, 1 month ago by
Milos Jovanovic.
-
This reply was modified 1 year, 1 month ago by
The topic ‘Image alignment’ is closed to new replies.