Results 1 to 9 of 9
Thread: Centering Multiple Table Cells
-
2012-04-01, 02:07 AM (ISO 8601)
- Join Date
- Mar 2005
- Location
- Edmonton, AB
- Gender
Centering Multiple Table Cells
I'm in the middle of writing up a homebrew class and in making one of the tables I've run into a problem. I want to center the text within each of the cells. Is there a simple way to do this, or would I need to use the [center][/center] tags inside each individual cell?
That's over 220 cells.... ugh, I can feel the headache already!
Same question, different way of asking:
Is there an easy way to make the following table look like the centered table below it?
{table=head]Example table|Yippee!|Woot|Huh?|Oh, really...?
1|2|3|4|5
1|2|3|4|5
1|2|3|4|5[/table]
{table=head]Example table|Yippee!|Woot|Huh?|Oh, really...?
1|2|3|4|5|
12|3|4|5|
12|3|4|5[/table]
Hmm... Even with individual center tags, I can't get the example table here to work. It's keeps glitching and erasing some of the tags on me whenever I click the preview button... So weird.Last edited by Kumori; 2012-04-01 at 02:17 AM.
-
2012-04-01, 09:31 AM (ISO 8601)
- Join Date
- Nov 2005
- Location
- By a Park
- Gender
Re: Centering Multiple Table Cells
Yeah, there is a bug in the parser. Table screws up certain tags at the beginning and end of each row unless you add a gratuitous pipe before hitting the carriage return. In other words, pretend the last cell of each row actually has an extra cell with no content after it. Like so:
{table=head]Example table|Yippee!|Woot|Huh?|Oh, really...?
[CENTER]1[/CENTER]|[CENTER]2[/CENTER]|[CENTER]3[/CENTER]|[CENTER]4[/CENTER]|[CENTER]5[/center]|
[center]1[/CENTER]|[CENTER]2[/CENTER]|[CENTER]3[/CENTER]|[CENTER]4[/CENTER]|[CENTER]5[/center]|
[center]1[/CENTER]|[CENTER]2[/CENTER]|[CENTER]3[/CENTER]|[CENTER]4[/CENTER]|[CENTER]5[/CENTER][/table]
Gives you:
{table=head]Example table|Yippee!|Woot|Huh?|Oh, really...?
1|2|3|4|5|
1|2|3|4|5|
1|2|3|4|5[/table]
As to your primary question:
If you don’t mind the table itself being centered, you can place “center” tags around the whole table, and each cell will inherit the centering:
[center]{table=head]Example table|Yippee!|Woot|Huh?|Oh, really...?
1|2|3|4|5
1|2|3|4|5
1|2|3|4|5[/table][/center]
Gives you:
{table=head]Example table|Yippee!|Woot|Huh?|Oh, really...?
1|2|3|4|5
1|2|3|4|5
1|2|3|4|5[/table]Last edited by Shhalahr Windrider; 2012-04-01 at 09:37 AM.
The Future just ain’t what it used to be.
-
2012-04-01, 03:58 PM (ISO 8601)
- Join Date
- Feb 2011
Re: Centering Multiple Table Cells
It doesn't inherit centering on my Firefox 11.
-
2012-04-01, 04:40 PM (ISO 8601)
- Join Date
- Nov 2005
- Location
- By a Park
- Gender
-
2012-04-01, 05:25 PM (ISO 8601)
- Join Date
- Aug 2007
Re: Centering Multiple Table Cells
Interested in MitD? Join us in MitD's thread.There is a world of imagination
Deep in the corners of your mind
Where reality is an intruder
And myth and legend thrive
Ceterum autem censeo Hilgya malefica est
-
2012-04-01, 06:29 PM (ISO 8601)
- Join Date
- Nov 2005
- Location
- By a Park
- Gender
Re: Centering Multiple Table Cells
Okay, well apparently the center tag uses the deprecated DIV align attribute rather than CSS. Of course, using a simple CSS text-align wouldn’t center the table anyway, though it does appear to center the text within it.
The Future just ain’t what it used to be.
-
2012-04-02, 02:31 AM (ISO 8601)
- Join Date
- Mar 2005
- Location
- Edmonton, AB
- Gender
Re: Centering Multiple Table Cells
So in the end I have to center each cell individually. Tedious, but that's just the way it is. In any case, thanks for the help.
-
2012-04-02, 06:13 AM (ISO 8601)
- Join Date
- Nov 2005
- Location
- By a Park
- Gender
Re: Centering Multiple Table Cells
You could cut down on the tedium by composing the table with a text editor and then using the Find and Replace function to replace every “|” with “[center]|[/center]”. If your text editor works properly, you may also be able to make it work with the end of row cells—type it out once and the copy and paste it into the find/replace fields.
Or you could just copy a “[center]|[/center]” to the clpboard and at the end of each cell, instead of typing the whole thing out, press Ctrl-V, or ⌘-V if you are a Mac user. That makes it easier.The Future just ain’t what it used to be.
-
2012-04-02, 06:22 AM (ISO 8601)
- Join Date
- Sep 2005
- Location
- Australia
- Gender
Re: Centering Multiple Table Cells
Or just pre-set up the table, then type your data in between the [center][/center].
"My Hobby: Replacing your soap with gravy" by rtg0922, Doll and Clint "Rawhide" Eastwood by Sneak