You are viewing limited content. For full access, please sign in.

Question

Question

How do I center a column in a table?

asked on December 4, 2015 Show version history

I've centered the title above each column, I'm looking to center the field below each title, as well as the number within the field.

 

Thanks!

0 0

Answer

SELECTED ANSWER
replied on December 4, 2015

Sorry about that. Try this:

td input {text-align: center; display: block; margin: 0 auto;}

 

2 0

Replies

replied on December 4, 2015

This code should work:

td input {margin:auto; text-align:center;}

This will set all your inputs in all tables to center. You can limit it by preceding the css rule with an id or class as such:

#q23 td input {margin:auto; text-align:center;}

 

1 0
replied on December 4, 2015

Chris,

Thanks for the help! This centered the text within the field, but not the field itself:

Any idea how to align the fields under their column titles?

0 0
SELECTED ANSWER
replied on December 4, 2015

Sorry about that. Try this:

td input {text-align: center; display: block; margin: 0 auto;}

 

2 0
replied on December 4, 2015

Perfect! Thanks!!

0 0
replied on October 11, 2016

How did you center the title above the column?

You are not allowed to follow up in this post.

Sign in to reply to this post.