Printing with linked style sheets

admin

Administrator
Staff member
I have never seen this mentioned as a bug in iE5 so perhaps it's me. In simple terms, if I define a style such as
.cen {text-align: center;} in a linked style sheet, then use

<LINK href=http://www.webdeveloper.com/forum/archive/index.php/"styles.css" media="screen" rel="stylesheet" type="text/css"> in my page header and
<DIV class="cen">Some centred text</DIV> on my page it is fine on screen, but the style is ignored when printed on paper (and in print preview).
My rather unsatifactory fix for this is to replicate every class used on any page likely to be printed. Has anyone else experienced this? Do any other browsers behave this way ?Originally posted by gizmo
Do any other browsers behave this way ? All the good ones. That's what media="screen" means. See <!-- m --><a class="postlink" href="http://www.w3.org/TR/html4/struct/links.html#h-12.3.2.Thanks">http://www.w3.org/TR/html4/struct/links ... 3.2.Thanks</a><!-- m --> for that. Some of the CSS on my site is a legacy from when I was first learning it and I would cut & paste things without understanding the implications of what they did. If it seemed ok I would move on.In other words, thats how a browser should behave.
<link... media="screen"> means that the corrseponding CSS is applied only to "screen" medium, ie when you use a visual browser. When you print it, these styles will not be applied.

You could do the following:
<link... media="all"> so that the style sheet is used for all media.

Better still, you can have another style sheet for printing and use
<link... media="print">
The advantage of the latter is that you do not need different "printer firendly" pages... your current page is already printer friendly. You dont need any navigation buttons to be printed, you may prefer serifed fonts in print while sans-serif on screen, etc.In fact that is what I was doing, but my initial lack of understanding meant that in print.css a lot (most in fact) of the styles were omitted.:) I am now trawling through my 90-odd pages of web site to remedy things.
 
Back
Top