Tim Rogers wrote:
Hi!
how do I get around the problem of safari failing to fit a table row to the
size of the text based content in the same was as IE does? For example if I
were to create a 5 row table add text in the <td> and style it via the <p>
tag, IE would collapse the table to fit the height of the said text. In
Safari in wont, so there is always unwanted padding in the table. This means
its hard to make neat tables in safari and they end up taking up twice as
much space as they should do!
You haven't indicated what doctype you are using or supplied any markup
or link so the difference in display could be a consequence of that.
I guess that you are referring to markup similar to this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>P padding test</title>
</head>
<body>
<table border="1">
<tr>
<td>Here is some text</td>
</tr><tr>
<td><p>Here is some text in a P</p></td>
</tr>
</table>
</body>
</html>
In IE, both the above rows will have the same height. In Firefox (and
some other browsers), the second row is about twice as high. If you
remove the doctype, Firefox will display the page just like IE does (I
don't know what Safari will do).
I'd suggest that you use the strict doctype (HTML 4 has been around for
6) and keep IE happy be adding the following CSS element to the head to
remove the padding and margin from P elements inside TD elements:
<style type="text/css">
td>p {padding:0; margin:0}
</style>
Removing the padding and margin from the td will 'collapse' it further.
--
Rob