Need a FREE iContact email marketing company. The best one, do you know of any?
Try iContact email marketing for free for 30 days. Click here to use coupon...
Get a free trial of iContact here. Click here for this special deal...
Got a question... Need a FREE iContact email marketing company. The best one, do you know of any? Thanks in advance for any comment. Second question.. Hello..
I have to render html pages and i'm a little stuck on table layout. I have some questions if someone can explain me please:.
I. Border size makes part of table size?.
For example, if we have something like:.
<table border="4" width = 100>.
<tr><td>content is here.
</table>.
How should I compute size of table? i.e. first td has it's x and y coordinates(based on x,y coordinates of table): x = XTable + 4 ; y = YTable + 4 ??.
About last td, what can you say? it's width will stop on coordinate 100(width of the table) - 4(border size)?.
II. Approximately same questions about cellspanig, cellpadding and TD widths. For example, if we have:.
<table width="100" border="2" cellspacing="2" cellpadding="2">.
<tr><td width="50">abc</TD><td width="50">def</TD></TR>.
<tr>.
<td>g</TD><td>h</TD></TR>.
</table>.
How should I compute widths of td?.
I'm trying to make something like this:.
Table width = W = 100.
Cellspacing = CS = 2.
Cellpadding = CP = 2.
Border = B = 2.
Now, for the first TD, I take it's given width (50) = B + CS + CP + width for data + CP + CS/2 ??? after I put data in "width for data", I set real width for td as CP + width for data + CP. Is this corect?.
For next TD, I take that percentage and compute it as being 50 pixels (50 * W)/100 and I do same algorithm.
Td width = 50 = CS/2 + CP + width for data + CP + CS. Can this be good?.
III. Last question(I think that you are still with me.
) ).
Let's take the above example, slightly modified:.
<table width="100" border="2" cellspacing="2" cellpadding="2">.
<tr><td width="50">abc</TD><td colspan="2">def</TD></TR>.
<tr>.
<td>g</TD><td>h</TD><td>i</TD></TR>.
</table>.
As you can see, I added one more column, and last TD from the first row spans 2 columns(last ones).
Now, for the first TD is the same algorithm as above. For second TD I compute remaining width and the result is 50 pixels. I presume that this result include cellspaning and cellpadding that are theoreticaly between those two columns that are spaned..
So, last TD width = CS/2 + CP + width for data, including 2*CP + CS, that are space for data too + CP + B. What do you think of that.
I'm so sorry for this looong post, but i'm really confused in the chaos of tables. I f someone can please help, i'll be really gratefully..
Best regards..
That's a good question. I'm not sure what is the answer to that question. I'll do some poking around and get back to you if I bump into an decent answer. You should email the people at iContact as they probably could give you help..
Thank you so much for your response Horus_Kol..
You said that: "the cellspacing and cellpadding attributes, along with height and width, are deprecated in HTML 4 - their functions have been replaced by CSS styling." Well... there are still so much htmls that used this attributes and I have to do this I'm afraid.
"your table is 100 pixels wide..
Part of that width is given to the border..
For a 4 pixel wide border, you are actually taking 8 pixels from the width (one border at BOTH sides)..
Likewise, the cellspacing/padding is 2 pixels on BOTH sides, so you need to allow for another 4 pixels on every cell.".
As I see, I thought at this too. What I don't understand is what is happening in case that I have a table with 100 pixels width, a cellpadding and a cellspacing 2 pixels and 2 TD's with 50 pixels each..
If I take 50 pixels for each td and add cellspacings => 2(left cellspacing) + 50(first td) + 2(middle cellspacing) + 50(second td) + 2(right cellspacing) = 106 pixels, which is greater than table width(100). So, I think that width defined for td's in general, includes cellspacing also. Am I right?.
Thanx again for your response and Best Regards..
Can someone give me a hint please about cellspacing and cellpadding? Theese sizes make part from a given width of td? Thank you..
I think you have confused yourself... looking at tables too deeply..
Say a table is 100px width... as long as the data fits into it, it will not expand past 100px. If you add a border then minus it's width of both sides as HK pointed out... equally the same with cell padding and spacing..
If you need to be exact about your tables then look at css... if not then do not look so deeply at them..
I would like to point out though that cell spacing and padding are not deprecated in HTML 4.01...
With other words, a td given by author size includes the size of cellpading, cellspacing and eventually border around it, corect?.
I think so too. Without kiding, in past 3 weeks I looked on so much htmls (around 3000) that I dream this at night.
, and most of them are using cellpading, cellspacing, colspan and rowspan. Not much are using css..
Thank you entimp for your response..