/    Sign up×
Community /Pin to ProfileBookmark

Printing with linked style sheets

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=”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 ?

to post a comment
CSS

4 Comments(s)

Copy linkTweet thisAlerts:
@CharlesMay 22.2003 — [i]Originally posted by gizmo [/i]

[B]Do any other browsers behave this way ? [/B][/QUOTE]
[font=georgia]All the good ones. That's what [font=monospace]media="screen"[/font] means. See http://www.w3.org/TR/html4/struct/links.html#h-12.3.2.[/font]
Copy linkTweet thisAlerts:
@gizmoauthorMay 22.2003 — Thanks 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.
Copy linkTweet thisAlerts:
@nkaisareMay 22.2003 — 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.
Copy linkTweet thisAlerts:
@gizmoauthorMay 22.2003 — 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.
×

Success!

Help @gizmo spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...