wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Table Design using Absolure or Relative Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Table Design using Absolure or Relative" Watch "Table Design using Absolure or Relative" New topic
Author

Table Design using Absolure or Relative

sudha swami
Ranch Hand

Joined: Apr 24, 2007
Posts: 179
Hi,
1.Which is the best way to design the tables?
Absolute or relative
2.What are the advantages/disadvantages for each one?

regards
sudha
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61082
    
  66

Design what tables? I've never used either of relative or absolute positioning with a table. What are you trying to achieve?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
sudha swami
Ranch Hand

Joined: Apr 24, 2007
Posts: 179
i am using HTML Tables
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61082
    
  66

Why do you feel the need to use positioning with the tables? Are you trying to do something special with them? I don't understand why you are even asking the question. Under normal circumstances, you don't need to specify positioning for any HTML element, let alone tables.
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
I have to admit that my projects use a lot of tables (and nested tables) for laying out pages but I hear people talk about using CSS and absolute and relative positioning instead of tables. Is this what you are asking about?

I cannot say I know much about this topic, but a quick web search turned up this site that looks to have good info: http://www.yourhtmlsource.com/stylesheets/csslayout.html

- Brent
Jay Damon
Ranch Hand

Joined: Jul 31, 2001
Posts: 282
Under normal circumstances, you don't need to specify positioning for any HTML element, let alone tables

Bear, would you clarify or expound upon this statement? I agree with you regarding tables but I struggle with various browser positioning issues every day. If there is a way to avoid the struggle, I'd like to know what it is. My experience is that some positioning is required especially if one wants to be cross-browser compatible.
sudha swami
Ranch Hand

Joined: Apr 24, 2007
Posts: 179
Hi,

Sorry for the confusion.

My question was related to this sample:


<table border="0" width="618">
<td width="40">Area </td>
<td width="20">District </td>
<td width="100">Site </td>
</table>

The width which i specified above i was referring as absolute.

or
<table border="0" width="85%">
<td width="10%">Area </td>
<td width="10%">District </td>
<td width="55%">Site </td>
</table>

The width which i specified above i was referring as relative.

I was not very sure which one to use? What is the advantage/ disadvantage for each of them?

regards
sudha
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61082
    
  66

Ah, yes that was confusing.

Well, first of all, you should be using CSS to supply the width rather than attributes in the HTML.

A fixed width will be the same size no matter what size you make the window. A percentage will scale with the window. The "best" one is the one that does what you want.
sudha swami
Ranch Hand

Joined: Apr 24, 2007
Posts: 179
Thanks Bear..
Can you please suggest some links/tutorials where tables attributes are using CSS. I have not used till now.

Sudha
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61082
    
  66

Originally posted by Jay Damon:

Bear, would you clarify or expound upon this statement? I agree with you regarding tables but I struggle with various browser positioning issues every day. If there is a way to avoid the struggle, I'd like to know what it is. My experience is that some positioning is required especially if one wants to be cross-browser compatible.

You'll need to elaborate your issues. Between "normal" browser layout and CSS properties like float, I rarely find myself using the CSS position property except for things that need special positioning (like layered dialogs, and fixed footers, and the such).
[ March 05, 2008: Message edited by: Bear Bibeault ]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Originally posted by sudha swami:
Can you please suggest some links/tutorials where tables attributes are using CSS.
The <table> element can be assigned CSS styles in the same way as any other HTML element. So if you've seen CSS tutorials that use, say, <div> elements and apply styles to them, just mentally replace "div" by "table" and that's just about all you need to know.
Jay Damon
Ranch Hand

Joined: Jul 31, 2001
Posts: 282
Bear,

I was intrigued by your use of the word any. Also, I broadly interpreted positioning to include top, left, etc. not just the position attribute. Finally, my pages do include fixed headers, footers and status areas.

That said, I apparently have more problems with "normal" browser layout than you. Simple pages are never a problem but it seems like anytime I attempt a page that is the least bit complicated, it is never rendered the same in all browsers and I am forever tweaking it to get it to look right in browsers we support.

It may be overkill but I finally sat down and wrote a JavaScript function to resize pages to address the inconsistencies among browsers then hooked it into the onload and onresize events. I would prefer not to have to do this but it has solved a lot of my problems.

That's the reason I inquired about a magic solution!
sudha swami
Ranch Hand

Joined: Apr 24, 2007
Posts: 179
thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Table Design using Absolure or Relative