Forum Moderators: not2easy

Message Too Old, No Replies

Internet Explorer 5.0 bug

Is it a CSS problem?

         

TheDoctor

6:33 pm on Oct 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've just recently (a couple of months ago) changed my entire site to XHTML/CSS. Now a user has emailed me complaining that presentation problems have appeared. He is using IE5.0.

I got him to send some screenshots, and it looks as if IE5 is applying the CSS rules contained in @media print {...} on the screen. Eg my CSS file says (simplified version):


@media print {
a:link { color:black; text-decoration:none; }
}

and, sure enough, links appear on his screen in black with no underline.

Have I understood the problem correctly? What is the workaround for this?

TheDoctor

5:16 pm on Oct 22, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Supposedly, it is possible to suppress CSS rules in IE5 using a comment bug (see [w3development.de...] but this doesn't seem to be solving my problem.

Anyone know anything about this?

[edited by: Nick_W at 5:23 pm (utc) on Oct. 22, 2003]
[edit reason] corrected link 404 [/edit]

TheDoctor

4:17 pm on Oct 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



(Following the link will get a 404, because it includes ")," at the end. Remove this, and you'll get to what papabaer called an "invaluable" reference chart - see [webmasterworld.com ])

In fact, the bug does solve my problem, provided I follow the instructions literally. They call for placing a comment ('/* */') immediately after the selector. Thus, in my example,


@media print {
a:link/* */ { color:black; text-decoration:none; }
}

will cause Internet Explorer 5 to ignore the rule.

Where I initially went wrong was to allow a space to intrude between the selector and the comment. Do that and it causes IE5 to process the rule correctly.

I am interested in why no one volunteered an answer. Am I the only person to be affected by IE5's mishandling of "@media print"? Does no one else use CSS to format printed web pages differently from what appears on the screen, or do other people use a different technique? Should I have approached the problem in a different way? I'd be interested in comments.

tedster

4:55 pm on Oct 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In my case, the answer is no, I haven't been using @media print, although I feel like I "should".

I'm not working with sites that require a lot of printing right now, and the clients involved don't want to pay extra to have everything print well -- just a few special sections where we make downloadable files (pdfs and rtfs) for printing.

That said, I've been following your one-sided conversation with interest. You've taught me something (don't include a space) and you've reminded me of other things I'm sure I will need sooner or later. Much appreciated.

TheDoctor

10:58 am on Oct 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I appreciate that use of techniques are, for those in the commercial world, going to be driven by the demands and tastes of customers. This is true of any technique, not just those of CSS. I just hadn't expected that the use of CSS to format printed web pages was as rare as the lack of response to my query seems to imply.

It's not that there's no need for printable web pages. There exist a large number of web sites - including WebmasterWorld - that offer "printer-friendly" pages. This option is, in general, unnecessary for sites that use CSS, since CSS2 can be used to format pages differently for print and for screen. Thus, on the printed page, you can hide "back to the top of the page" links and the suchlike, you can change the fonts to pts and the colour to black, alter the way headings are presented, etc (you can think of your own examples).

With a page formatted for printing using CSS, therefore, the user does not need to download an extra page to print the information, and the developer (or the server, if the pages are dymnamic) does not need to create two separate pages containing the same information. (The need for one page rather than two is, incidentally, a point Brett Tabke should take into account when calculating whether or not CSS adds to downoad time [webmasterworld.com]). This technique even works with Internet Explorer versions 5.5 and 6, so the "design for IE" people are going to be kept happy.

It is also possible, for Mozilla and Opera users, to offer large print formats. (A couple of months ago I suggested that CSS could be used to solve the problems of people with poor vison, and Nick_W responded that he thought this would be difficult. It isn't - although it involves some effort if you're converting an existing site rather the building the facility into a site from scratch.)

Of course, as long as business insists on using yesterday's technologies, then none of this is really going to get used, which is a pity.