Center align text
-
Hi there,
I am looking to align all the text in a certain cell to the center. I’m sure its very simple but I’m very new to this and I would appreciate some advice.
Cheers
Mehdi
-
Hi,
thanks for your question.
To do that, you will need a little bit of CSS code. Please see this article in the FAQ to understand how to influence a single cell: http://tablepress.org/faq/highlight-cells-or-content/
Instead of changing the background color as in that example, you’ll then need this CSS code to center:text-align: center;Regards,
TobiasHi Tobias,
Thank you for the reply. I tried what you said and unfortunately, I think mostly due to my lack of experience, I cant get it to work. I need numerous cells to be centrally aligned and neither have done so.
I’ll copy the code into here and let me know what I’m doing wrong. Thank you very much in advance>
.tablepress-id-4 .row-1 .column-a {
text-align: center;
}.tablepress-id-4 .row-1 .column-b {
text-align: center;
}.tablepress-id-4 .row-1 .column-c {
text-align: center;
}.tablepress-id-4 .row-1 .column-d {
text-align: center;
}.tablepress-id-4 .row-2 .column-a {
text-align: center;
}.tablepress-id-4 .row-2 .column-b {
text-align: center;
}.tablepress-id-4 .row-2 .column-c {
text-align: center;
}.tablepress-id-4 .row-2 .column-d {
text-align: center;
}.tablepress-id-4 .row-4 .column-a {
text-align: center;
}.tablepress-id-4 .row-4 .column-b {
text-align: center;
}.tablepress-id-4 .row-4 .column-c {
text-align: center;
}.tablepress-id-4 .row-4 .column-d {
text-align: center;
}Hi,
basically, you will just have to use the column number instead of the letter. Additionally, you can shorten that CSS a lot:
.tablepress-id-4 .row-1 .column-1, .tablepress-id-4 .row-1 .column-2, .tablepress-id-4 .row-1 .column-3, .tablepress-id-4 .row-1 .column-4, .tablepress-id-4 .row-2 .column-1, .tablepress-id-4 .row-2 .column-2, .tablepress-id-4 .row-2 .column-3, .tablepress-id-4 .row-2 .column-4, .tablepress-id-4 .row-4 .column-1, .tablepress-id-4 .row-4 .column-2, .tablepress-id-4 .row-4 .column-3, .tablepress-id-4 .row-4 .column-4 { text-align: center; }If you post the link to the page with the table, I’ll gladly take a look to see if we can make this even shorter.
Regards,
TobiasThank you.
Here is the link:http://goirani.com/each-package-payment-options/
I am trying to create a table which I have created in MS Word. I can send you a version if you like.
Thank you. Much respect for your work here.
Mehdi
Hi Mehdi,
thanks for the link. Unfortunately, I can’t open the page, as it just asks me for an email address 🙁
Additionally to the link, can you post which cells you want centered?Regards,
TobiasHi Tobias,
Sorry for the mistake there.
I am wanting to center all the text in column 2.3.4 on all rows up to row 20.
Here is the link.
http://goirani.com/listing-package-tick-table/It seems like I have ti scroll to the next page to see all the rows. Can I make them all appear on the same page?
Thank you
Hi,
unfortunately, I still can’t see the table 🙁 It’s still asking me to enter my email address to get notified…
Centering those cells should not be a problem, but I’d need to see the table to be sure.
To make all rows appear on the same page, just uncheck the “Pagination” checkbox on the table’s “Edit” screen.
Regards,
TobiasHey Tobias, Sorry about that. Its been disabled so you should be able to go in and check that.
Hi,
thanks, no I can see the table. 🙂
Please replace all of your “Custom CSS” with this:
.tablepress-id-5 img { margin: 0; border: 0; background-color: transparent; } .tablepress-id-5 .column-2, .tablepress-id-5 .column-3, .tablepress-id-5 .column-4 { text-align: center; }Regards,
TobiasAbsolutely perfect. Thank you for the support and the great plugin.
Hi,
great! 🙂 And no problem, you are very welcome!
Best wishes,
Tobias
The topic ‘Center align text’ is closed to new replies.