Table cell sizes

liunx

Guest
I'm building a table and each cell is specified in it's width and height attributes. The problem is that there is an inconsistency between Netscape and Explorer.<br />
<br />
if i make a cell size as 50px by 50 px, shouldn't it be just that exact pixel size in any browser?<br />
<br />
i also have the table set at cellpadding=0 and cellspacing=0<br />
<br />
<br />
help anyone!<!--content-->Originally posted by Nulrick <br />
if i make a cell size as 50px by 50 px, shouldn't it be just that exact pixel size in any browser?No, actually. The TABLE element is intended for tables. That is to say, for tabular data, to show the relationships between and among various datum. As such you can only ever specify a minimum size for a cell. The browser is expected to expand the cell to contain the data. From the HTML 4.01 Specification:<br />
Tables should not be used purely as a means to layout document content as this may present problems when rendering to non-visual media. Additionally, when used with graphics, these tables may force users to scroll horizontally to view a table designed on a system with a larger display. To minimize these problems, authors should use style sheets to control layout rather than tables.<br />
<!-- m --><a class="postlink" href="http://www.w3.org/TR/html4/struct/tables.html#h-11.1">http://www.w3.org/TR/html4/struct/tables.html#h-11.1</a><!-- m --><!--content-->To get something exact you should use a css layout, and the object you would be using would be a <div> instead of a table. With css you can do something like style="height:15px;" and the div will be 15px and then you can set the overflow (what the browser does if the junk inside does not fit the size you specified) visible, hidden, auto, or inherit, and scroll, play around with those if you like at <!-- m --><a class="postlink" href="http://www.w3schools.com/css/tryit.asp?filename=trycss_overflow">http://www.w3schools.com/css/tryit.asp? ... s_overflow</a><!-- m --> <br />
Also netscape and ie are different browsers, css can make those sizes pretty close to being the same but there will always be some difference when you view things on different browsers.<!--content-->
 
Back
Top