The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Centering text in all cells inside a bbcode table?

View previous topic View next topic Go down

Solved Centering text in all cells inside a bbcode table?

Post by Handyy on February 7th 2013, 11:02 pm

Hello,

Is there a way to make everything centered inside a bbcode table without having to use [center] inside every [td]?

Thanks!


Last edited by Handyy on February 8th 2013, 3:35 pm; edited 1 time in total

Handyy
Forumember

Posts : 32
Reputation : 0
Language : English

Back to top Go down

Solved Re: Centering text in all cells inside a bbcode table?

Post by koolkat96 on February 8th 2013, 3:13 pm

Nope. I don't think so but let's see.....maybe there is a way to do that.

koolkat96
Forumember

Female Posts : 584
Reputation : 7
Language : English
Location : Bangalore, India

http://houkago-tea-time.forumakers.com/

Back to top Go down

Solved Re: Centering text in all cells inside a bbcode table?

Post by Neymar1 on February 8th 2013, 3:31 pm

@Handyy wrote:Hello,

Is there a way to make everything centered inside a bbcode table without having to use [center] inside every [td]?

Thanks!

Yep, there's a way. I'll try and explain it a little as well.

So your table will start off looking like this:



When you set up a table the first little bit of bbcode is [table border="1"]. What you need to do is add a class to that by doing this:

Code:
[table border="1" class="your-table"]

That means we can now edit this specific table with CSS by using
Code:
.your-table

So your table in the post you have made will now look something like this:

Code:
[table border="1" class="your-table"][tr][td]anything[/td][td]testtest[/td][td]testest[/td][/tr][tr][td]is[/td][td]wow[/td][td]hey[/td][/tr][tr][td]possible[/td][td]oh my[/td][td]jeez[/td][/tr][/table]

To center the text within the "td", add this to your CSS:

Code:
.your-table td {
  text-align: center !important;
}

Your table will then look like this:



Hope that helps.

Neymar1
Forumember

Male Posts : 406
Reputation : 27
Language : HTML, CSS, and a bit of JavaScript
Location : Scotland

http://www.simplyfifa.com

Back to top Go down

Solved Re: Centering text in all cells inside a bbcode table?

Post by Handyy on February 8th 2013, 3:33 pm

Thanks, this is a perfect solution for me!

Handyy
Forumember

Posts : 32
Reputation : 0
Language : English

Back to top Go down

Solved Re: Centering text in all cells inside a bbcode table?

Post by Jophy on February 8th 2013, 4:08 pm

Topic Solved & Locked

Jophy
ForumGuru

Male Posts : 17924
Reputation : 835
Language : English
Location : Somewhere

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum