Archived topic
Fixed width table cells
5 replies · Started by David on July 21, 2022
Hi there
Is there a way to fix the width of all tables - maybe with a CSS code?
They always show better on mobile when they are fixed. So instead of going back and finding all tables, a code would be nice.
Thanks
David
Hi there,
can i see a post/page with a table on your site ?
I have attached a post;
Looking at it now, maybe it's best not to fix the width and let the user scroll - it's a mobile issue when displaying wide tables.
While I was looking at it, I was looking at the typography options to make the text smaller, but there is not one that is specific for tables - do you have a CSS code to define the typography size for tables?
Thanks
OK so there are some options:
1. You can set a fixed with on smaller screen sizes so the table will scroll:
@media(max-width: 768px) {
.wp-block-table td {
width: 250px;
}
}
2. Font sizes
Go to Customizer > Typography, and Add Typography and from the Element list select: Custom and in the Enter custom CSS selector. field add: .wp-block-table
Then you can set desktop, tablet and mobile font styles.
Perfect! That looks great now. Thanks a lot David.
Awesome - glad to hear that!