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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IE Printing ignores CSS overflow:hidden 1

Status
Not open for further replies.

Rohdem

Programmer
Sep 20, 2000
553
US
I have been pulling my hair out trying to fix this stupid problem. Google isn't helping me, so I'm asking for help here!

I have a simple html table that is being built and populated with data using PHP. On this webpage, outside the php code, I have the following:

<style type="text/css" media="print,screen">
div {
height:10px;
overflow:hidden;
}
</style>

Then inside each <td> of the table, I surround the table contents with <div> and </div>. The purpose of this is to limit the table rows to 1 line of text, and cut off anything else.

This WORKS FINE when displaying the table on the screen in both IE and firefox. In firefox, it works fine when printing also.

BUT...
In IE, when I print, it wraps the cell contents and doesn't cut it off.

Does anyone have any ideas how to fix this?

Thank you in advance for any help you could provide!
 
That is a pretty good idea! Not the perfect solution, but it may be the best I've got. Why is it IE is ALWAYS the problem?
 
It's always a bit of a lottery trying to get IE to behave. Here's a couple of ideas...

Have you tried removing the [tt]media="print,screen"[/tt] attribute? Unless there's some other type of media which you're trying to avoid targetting, it's not really doing anything.

Have you tried applying the [tt]height: 10px[/tt] directly to the <td>, rather than to <div>s nested inside it?

Maybe IE objects to a pixel measurement when used on paper? You could add something like
Code:
<style type="text/css" media="print">
div {
height:10pt; /* or whatever distance works for you */
}
</style>


-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Thanks for the suggestions Chris. I actually have tried it without the media="print,screen" part with the same result. I also put the height in the <td>, no luck.

Interesting that when I change the height to 50 or something in the style section, it applies this to the screen and printing in IE. So its not that IE is completely ignoring the CSS when printing, it seems as if its just completely ignoring the overflow:hidden part. Got to love IE
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top