This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Table Design using Absolure or Relative

 
sudha swami
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Design what tables? I've never used either of relative or absolute positioning with a table. What are you trying to achieve?
 
sudha swami
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am using HTML Tables
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21308
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic