/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] media=print / media=screen

Hiya,

I have both print and screen options for CSS. The print CSS file sets some aspects to hidden so they don’t get printed (header/footer, menu etc).

As part of this I have an expandable/collapsable search box (using javascript). Now when the page loads the default state for the search box is hidden (this is outside of javascript) and sure enough it doesn’t appear on print preview or the actual print.

However when I toggle the search box to become visible, the print CSS file seems to get ignored as it always prints out. I have to manually hide it again for it not to show on the print out.

Is this by design (i.e. current state overwrites print CSS file), a bug in CSS/JS or something i’m doing wrong?

Thanks

to post a comment
CSS

2 Comments(s)

Copy linkTweet thisAlerts:
@aj_nscAug 31.2011 — Inline styles always take precedence over styles in an external CSS file - unless they are marked !important in the external file. You're using JS, no doubt to toggle the search box to display: block or visibility: visible; so in your print.css add the corresponding counter-acting rule with an !important next to it:

<i>
</i>#search { display: none !important; visibility: hidden !important; }
Copy linkTweet thisAlerts:
@ldoodleauthorSep 01.2011 — Lovely job.

Thanks ?
×

Success!

Help @ldoodle 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 6.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...