3 Replies - 652 Views - Last Post: 20 March 2013 - 12:23 PM

#1 Darkranger85  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 147
  • Joined: 31-August 12

CSS/HTML Table: Uniform cell sizes

Posted 19 March 2013 - 01:54 PM

Ok, I need to make a table that is going to hold dynamic information.

It's for the browser based game I'm currently working on and the table itself is going to hold player information. Things like their empire name, resources, etc etc.

But I want the table as a whole as well as the headings in the table and the cells position relative to the headings to stay the same even when the data inside is going to change.

Obviously one person might have a longer empire name than someone else, or different amounts of resources and such. But I don't want the table to get all wacky and look different as the data changes.

Whats the easiest way to accomplish this kind of thing?

Is This A Good Question/Topic? 0
  • +

Replies To: CSS/HTML Table: Uniform cell sizes

#2 andrewsw  Icon User is offline

  • It's just been revoked!
  • member icon

Reputation: 3611
  • View blog
  • Posts: 12,419
  • Joined: 12-December 12

Re: CSS/HTML Table: Uniform cell sizes

Posted 19 March 2013 - 02:17 PM

Sometimes the best option is to do nothing :) the browser has its own algorithm for calculating and rendering the column-widths.

Otherwise, you could dabble with css min-width, word-wrap, etc.
Was This Post Helpful? 0
  • +
  • -

#3 andrewsw  Icon User is offline

  • It's just been revoked!
  • member icon

Reputation: 3611
  • View blog
  • Posts: 12,419
  • Joined: 12-December 12

Re: CSS/HTML Table: Uniform cell sizes

Posted 19 March 2013 - 02:34 PM

Actually controlling column-widths within a table can be a pain. Previously, I've inserted a div into each cell of a column, or given every cell (TD) a specific class, or used nth-child and/or descendant (css) selectors to control them. We can't just, as one might suspect, use colgroup or col (or even columns) to control them.
Was This Post Helpful? 0
  • +
  • -

#4 Darkranger85  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 147
  • Joined: 31-August 12

Re: CSS/HTML Table: Uniform cell sizes

Posted 20 March 2013 - 12:23 PM

Alrighty, I'll give it a try by itself.

Otherwise I guess I'll have to try out some other options.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1