TABLE.TD.PRE - one more line below every cell

admin

Administrator
Staff member
Hello,

my tool generates HTML tables of short one-line cells. Spaces (at least leading spaces) must be preserved and cell-context must not be wrapped.

Options as <TD STYLE="white-space: pre"> or similiar CSS class don't work.

It seems that <TD><PRE> does the task, however it adds additional space between PRE and end of TD cell. All integrated with MS Explorer 5.50....

How do I remove that additional free space, please? Or any other ways to go?

Cheers and thanks for any tips,
Peter Tomo

-------------
<html>
<head>

<STYLE TYPE="text/css"><!--

table pre
{
font-family:"Times New Roman";
font-weight:normal;
font-style:normal;
font-size:9.0pt;
padding: 0;
spacing: 0;
}

td.like_pre
{
white-space: pre;
padding: 0;
spacing: 0;
}

table
{
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";
font-weight:normal;
font-style:normal;
font-size:9.0pt;
}

table td
{
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";
font-weight:normal;
font-style:normal;
font-size:9.0pt;
padding: 0;
spacing: 0;
}

--></STYLE>

</head>
<body>

<table border="1">

<tr>
<td><pre>OK, multiple spaces kept. BUT one additional line added between PRE and end of cell.</pre></td>
</tr>

<tr>
<td class="like_pre">BAD, multiple spaces truncated to one.</td>
</tr>

<tr>
<td style="white-space: pre">BAD, truncates multiple spaces.</td>

</tr>
</table>

<p style="white-space: pre">BAD, truncates multiple spaces (this doesn't matter to me).</p>

</html>If you use <pre style="display: inline"> you should get rid of that extra line at the bottom.

The CSS2 specification allows user agents (browsers) to ignore the white-space property in all stylesheets except the browser default.

AdamAdam,

that's fantastic! Thank you. I must read W3C CSS spec more precisely...

I have 2 more (long-story) issues:

1.
[Intro:
My tool recognizes space-indented tables in a specially marked zones inside a semi-structured text data (laws & judicature). The tables occupy whole lines, ie. they aren't floating elements and don't mix with structured text. My HTML output (tables) becomes a part of outer detected structured XML.

Outer XML transforms to indented DIVs or other HTML, and thus my inner tables bear their indentation. However, as my tables keep their own columns and left indentation, total left free space is accumulated.
]

Is there any "absolute" positioning of elements (table) that overrides outer HTML tags? I mean shifting table to left side of the page....

2. Maybe stupid: There are different non-zero gapses/free vertical spaces between my tables and outer HTML as opposed to zero gapses between two tables. However, I can't change CSS for outer HTML. How can I make so there is no vertical space between table and outer HTML?

Cheers,
Peter Tomo1. You might be able to use "float: left;", or "position: absolute; left: 0px;".

2. I think that gap is from the outer HTML's block element (e.g. <p> tag), but you might be able to reduce it using a negative margin-bottom value. Alternatively, add space between tables using a <p> element.

AdamAdam,

thank you.
"float: left;"
doesn't do the task, and it prints HTML which follows the tables at the right of my tables.
"position: absolute; left: 0px;" shifts my tables to the left - that's fine. But it prints HTML which follows the tables just over the tables. I need it below the tables.

I do read CSS2 spec, but I am lost in web of anonymous boxes etc....

Cheers,
Peter
 
Back
Top