Jump to content

@media Print Problem


wychegnome
 Share

Recommended Posts

I have implemented the @media print directive in my css file to suppress printing of the menu bar and some other items that are irrelevant on paper copy of web pages. This works well but has given rise to a different problem. Each printing is a page longer than needed so that, for example, a print requiring 2 pages of A4 prints out three pages. The header and footer entries point to the browser believing that the additional page is needed.The web site is http://www.s-r-s.org.uk and the site appearance is controlled through a single file srs.css. Sample line entries (there are others) in that css file are -@media screen {#navigation {position: fixed; top: 105px; left: 0px; width: 150px; text-align: center; }}@media print {#navigation {display: none; }}The problem occurs in IE8 and Firefox (I have not tested other browsers) but does not occur on a different site of mine that lacks any @media directives (www.wbcsg.org.uk).Is this problem an unexpected 'feature' of the @media print directive or have I misunderstood the implementation?Thanks in advance for any help or guidance.

Link to comment
Share on other sites

Problem SOLVED !!Caused traced to the menu system I had implemented and specifically this line of entry in the css file -.anylinkcss {position: fixed!important; absolute; left: 0; top: 0; visibility:hidden; }The CSS page on the W3School site states :- "visibility:hidden hides an element, but it will still take up the same space as before. The element will be hidden, but still affect the layout.". Effectively the print out included the menu structure in 'hidden' form, added at the end of the visible print.Changing to -.anylinkcss {position: fixed!important; absolute; left: 0; top: 0; display:none; }has cured the problem.Perhaps the Moderator of the forum could make it clearer on the "css/css_display_visibility.asp" page that the effect affects print as well as well as display.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...