Change a table on printing

T

Thomas Weiler

Hello,

I have a table with three cells:

<table>
<tr><td></td><td></td><td></td></tr>
</table>

Is it possible that when I print the document, to reposition the cells
vertically.

That the output is like that:

<table>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
</table>

I`ve tried a stylesheet with media=print. It works fine. Is it possible
to change the table with the stylesheet?

Thanks for all answers.
 
R

Richard Formby

Thomas said:
Hello,
G'Day.

I have a table with three cells:

<table>
<tr><td></td><td></td><td></td></tr>
</table>

Only three cells? Doesn't look like "tabular" data to me :)
Is it possible that when I print the document, to reposition the cells
vertically.
No.

That the output is like that:

<table>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
</table>

I`ve tried a stylesheet with media=print. It works fine. Is it possible to
change the table with the stylesheet?
No.

Thanks for all answers.

No problem.
 
T

Toby A Inkster

Thomas said:
Is it possible that when I print the document, to reposition the cells
vertically.

To expand upon RF's post: no.

Don't use a table; use DIVs or some other semantically appropriate
element. Position them (perhaps using "float") into columns in your screen
stylesheet, but not in your print stylesheet.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
 
J

Jukka K. Korpela

Scripsit Richard Formby:
Only three cells? Doesn't look like "tabular" data to me :)

Especially since the data content is fairly small. :)

In terms of CSS specifications, it actually is:

td { display: block; }

IE hasn't still learned to do this, so don't expect this to work on the WWW
in the next few years.

However, you could position the cells "absolutely" the way you like. Things
get a bit awkward then, especially since you would probably have to decide
on the heights and since the table, ripped naked by removing all of its
cells, might misbehave a little in rendering.

What you _can_ do effectively and easily with a table in CSS is to
_suppress_ printing of navigation blocks that are just a nuisance on paper
(and not much more on screen, someone might add). With

<table>
<tr><td class="navi">Some navi stuff here</td>
<td>Some real content here</td>
<td>The indispensable advertorials</td></tr>
</table>

you could have

@media print { .navi { display: none; } }
 
B

Brian Cryer

Thomas Weiler said:
Hello,

I have a table with three cells:

<table>
<tr><td></td><td></td><td></td></tr>
</table>

Is it possible that when I print the document, to reposition the cells
vertically.

That the output is like that:

<table>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
</table>

I`ve tried a stylesheet with media=print. It works fine. Is it possible to
change the table with the stylesheet?

Thanks for all answers.

As others have pointed out the real answer is no.

but, I think you can do it if you are crafty - there are lots of reasons for
NOT doing this - but if you generate not one but two tables, one formatted
for the screen and another formatted for the printer then presumably you can
control via the style sheet which of those is visible. As an approach it
sucks, so I wouldn't suggest doing it.

I would suggest thinking about how to change what you are doing, such as
using a different layout that wraps automatically.
 
R

Richard Formby

Jukka K. Korpela opined
Scripsit Richard Formby:


In terms of CSS specifications, it actually is:

I am well aware of the CSS specifications, as I know you are.
td { display: block; }

IE hasn't still learned to do this, so don't expect this to work on the
WWW in the next few years.

So then in the real world the answer remains as I specified: No.
 
J

Jukka K. Korpela

Scripsit Richard Formby:
So then in the real world the answer remains as I specified: No.

No it isn't. The use of HTML and CSS is not limited to WWW authoring. For
example, Firefox implements td { display: block; } properly, so the
technique would work in an intranet of a company committed to use Firefox or
a better browser, as well as in a user style sheet of a Firefox user.

Besides, as I described, the goal _can_ be achieved, at considerable cost,
even on IE, by using "absolute" position.

Just because it (probably) shouldn't be done doesn't mean that it cannot be
done.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,262
Messages
2,571,056
Members
48,769
Latest member
Clifft

Latest Threads

Top