Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Table Cell Widths not adding up

Status
Not open for further replies.

ice78991

Programmer
Nov 20, 2006
216
I am doing an experiment. In the following table I have set the <td>s so that they do not add up to the total screen width. By adjusting the px values (sep below say 10px) the display results are sometimes unpredictable. Is there a general rule used by browsers for handling this situation?

<table style="width:100%">
<tr>
<td style="width:50px">Hello1</td>
<td style="width:300px">Hello2</td>
</tr>
</table>
 
unpredictable" sounds like a pretty good description of the expected results. W3C specs aren't good at saying what browsers should do in contradictory situations like this. Browsers (one in particular) aren't great at following W3C specs anyway.

All the more reason to give sensible, and consistent, values to CSS properties.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
i believe it depends on the browser / cell padding / cell spacing / borders / available width / etc. if you want to specifically describe what a table looks like cross-browser, a) be sure you're using a complete document type and b) try using this style for the table itself:

[tt]table-layout: fixed;[/tt]



*cLFlaVA
----------------------------
[tt]"quote goes here"[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
And first explain it to yourself how is it possible for a table that has two columns, one having a width of 50px and the other having the width of 300px to stretch to anything but 350px? Or alternatively, to disregard your column widths.

___________________________________________________________
[small]Do something about world cancer today: PACT[/small]
 
What's the point of setting the width on the table to "100%" when you have set the width in each cell?? The browser would be thinking what is the right one.

- Lowet

[gray]Why can't all browsers parse pages the same way? It should be the Web designer who decides how to display the content, not the browser![/gray]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top