aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes HTML Table Column Widths Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "HTML Table Column Widths" Watch "HTML Table Column Widths" New topic
Author

HTML Table Column Widths

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1466
    
    1
I am trying to get column widths in my table to display at preset widths however when the page displays the settings are ignored.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67



[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1466
    
    1
I use <TD width="60"> in my HTML code(using JSTL to build table dynamically) and when the page displays the column is small(maybe 25).
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

What are you thinking that 60 means?
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1466
    
    1
Bear Bibeault wrote:What are you thinking that 60 means?


I don't really know for sure what unit it is. What I do know is that I have two div tags, each have a table in them, the first column of each is set to 60 and they do not line up as I had hoped they would.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

width is in pixels, and is deprecated.

Why are you not using CSS?
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1466
    
    1
Bear Bibeault wrote:width is in pixels, and is deprecated.

Why are you not using CSS?


I don't have an excuse other than I have not taken(had) time to learn the css method of programing(if you can call what I do programing).

I do have a css that controls my table layout but not the specific column widths. If I change the <TD> or <TH> tags in the css won't it affect all of the tags used on the page. How do I control only one column with the css?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

Depends upon the modern-inity of browsers you are supporting. If the browsers support nth-child, you're golden. Otherwise, you could give the columns class names to use as CSS hooks.

P.S. Not to sound mean or anything, but it's 2009. Wrap your head around CSS, and do it now.
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1466
    
    1
Bear Bibeault wrote:Depends upon the modern-inity of browsers you are supporting. If the browsers support nth-child, you're golden. Otherwise, you could give the columns class names to use as CSS hooks.

P.S. Not to sound mean or anything, but it's 2009. Wrap your head around CSS, and do it now.


Not to be hardheaded or anything but just for a test I put style="width:60px" in the TD tag of my HTML page code and still get the same results. If I set up the css won't it have the same line of code.

Can you give me direction on the class name and CSS hook method?

All of our users are on IE7.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

 
 
subject: HTML Table Column Widths