Archived topic
Table colum text wrap
7 replies · Started by Amit on June 14, 2021
Hi,
The table is wrapping text weirdly. Not sure why ? especially if its a 2 column table. Kindly review it and help me resolve it.
screenshot link:
Site link in the url area.
Hi Amit,
Table is not a well-responsive element, especially when it doesn't have a custom CSS class, it's hard to target in CSS.
You can give this CSS a try:
.postid-14548 figure.wp-block-table.aligncenter.is-style-stripes tbody > tr > td:first-child {
width: 20%;
}
Adding CSS: https://docs.generatepress.com/article/adding-css/
OK, I am new to CSS so a bit of a stupid question. Due to .postid-1458, this works only for a specific table? Can we do something generic that takes effect for all the tables?
OK, I am new to CSS so a bit of a stupid question. Due to .postid-1458, this works only for a specific table?
That's right. it's post specific.
Can we do something generic that takes effect for all the tables?
Can you specify the scope of which posts/pages you want the CSS to apply on?
If its for the single post pages, try this:
body.single-post figure.wp-block-table.aligncenter.is-style-stripes tbody > tr > td:first-child {
width: 20%;
}
ya, that is for single post pages :).
ya, that is for single post pages :).
The CSS I've provided should work then.
Let us know if you need further help. :D
Thanks, a lot Elvin. I will try and get back to you.
No problem.
Let us know how it goes.
Reminder: tables may require a bit more elaborate CSS for their width. we may have to add width properties to the other table column siblings.