News:

Join the Facebook Fan Page.

Main Menu

how to center a table?

Started by brynn, April 11, 2025, 11:29:55 PM

Previous topic - Next topic

brynn

Hi Friends,
I know in the past I've been able to wrap a table in the bbcode

[center][/center]
to center a table in a message. But it does not work anymore.

After a bit of searching, I found this not-too-old topic: https://www.simplemachines.org/community/index.php?topic=583803.0

Specifically, posts #18 - #20 seem to provide a solution. Do you all still agree with that as a good solution? Or has a better solution been found since that topic?

If that is a good solution, then I still need a bit of help. I cannot find any file called index.css. Is it in a particular folder? Possibly it lives in a part of the server which I do not have immediate access to. I only have access the forum files on our server. If index.css is on another part of the server, I'll have to ask my co-admin to make the edit.

Thanks for your help  :)

Edit
Sorry, I should say we're using version 2.1.4

Diego Andrés

Check this discussion has more relevant info: https://www.simplemachines.org/community/index.php?topic=586445.0

You can apply the fix: https://github.com/SimpleMachines/SMF/pull/7797
It should be fixed in 2.1.5... someday when it's released.

SMF Tricks - Free & Premium Responsive Themes for SMF.

brynn

I did see the exact same solution that I found in the other thread. And I can probably accomplish that solution. But I still need to know where to find index.css. Is it in a folder? Or nested within a few folders?

But I'm afraid most of that discussion is over my head. I don't know what to do with the github page. As far as I can understand, this has been fixed, and will be working in a future new version. But I could not understand enough to know what I can do now.

Can you give simple instructions to find the "fix" on the github page, and how to apply it?

Thanks.

Edit
Oh wow..... I clicked on the Files Changed tab (just looking around, without any particular goal), and I think there is the same index.css file I mentioned. And it looks like it's even the same code.

But the forum threads had said to put the code at the end of index.css, while it looks like on that page, it puts the code in a certain place within the file.

Did I find the fix?

Aleksi "Lex" Kilpinen

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

brynn

I was editing my last message while you were posting. Did I find the fix?

Aleksi "Lex" Kilpinen

Yup, you found it and you should be fine adding it in either location.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

brynn

Am I correct that I should not type the + signs at the beginning of lines 413, 414 and 415?


Aleksi "Lex" Kilpinen

Yes, Github just shows additions with a + and removals with a -.

So the code to add is

.centertext .bbc_table {
margin: auto;
}
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

brynn

Ok, I uploaded the new file. Now for a test....

Hhmm, no change. Looks like it didn't take. Trying again....

Hhmm, I'm not sure what's going wrong. What could I be doing wrong?

I upload the new file, and I click to Overwrite. I get a little message that says the transfer is complete. I look at index.css after the upload, and I see the new code is there. But I'm not getting expected results in the forum.

Maybe I need to restart something? Restart the browser maybe?

Aleksi "Lex" Kilpinen

Your browser might have the old css cached, you can try a hard refresh (usually ctrl+f5) to reload everything.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

brynn

Oh those caches!!

I'm not sure what a hard refresh is. I mean, I see that you wrote Ctrl + f5. But I don't know how a hard refresh is different from a regular refresh. I guess it must ignore the cache?

But it's getting very late here, so I'm going to sign off for tonight. Then I'll check on it tomorrow. Who knows? If nothing else, sleep can't hurt either!

I'll let you all know what happens.

Thank you all so much for your very kind patience. I appreciate it so very much!  :laugh:

Aleksi "Lex" Kilpinen

Yes, exactly a hard refresh is just a reload that ignores cache.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

brynn

#12
Ok, I'm finally back.

So the computer has been restarted, and I also tried Ctrl + f5, just in case. But the center tags are still not centering a table.

It looks like we have 6 mods installed. Could one of them be somehow blocking the new codes from working?

  • Simple Audio Video Embedder
  • Ultimate Menu
  • FancyBox 4 SMF
  • Topic First Image Rotator
  • SVG as Image Attachment Support
  • Stop Forum Spam

Edit
OH!! I'm happy to say Nevermind!! And we can mark this problem solved!

I decided to try actually clearing my cache, just to make sure. And now the table is centered!

Thank you all again for your help and patience!



Advertisement: