Forum Moderators: not2easy
When setting a printing style, is there a way to set the paper's margin, headers or footers -- or, at least make a suggestion to the browser.
When a press release is viewed on my page, I want it to use my site's template. However, if this document is printed, I want the press release to have the same format as a standard press release.
I'm almost there, it's just by default the browser puts a header and footer on the page. I know I and the users can change this by hand, but I was hoping there might be some browsers or a CSS standard that supports suggestions by the content creators.
Right now, I'm also offering a PDF version of the file, which I plan to continue to, but it would be nice to have to avoid a second step for site visitors.
@page selector covers the page's margins, however, I'm pretty sure hardly any browsers really support @page for print right this second :) As for a header and/or footer, which is a really cool idea, this seems almost impossible - barring having your entire content inside a table that has
thead and tfoot defined (if a table spills over a page when printed, it will reprint thead and tfoot at the top and bottom respectively.) While a possible hack-solution, it is a fairly icky one. So, I don't think I have any good news for you...
Does anybody else perchance have some?
you are supposed to be able to set a header on every page by just doing one header, and giving it
position:fixed; top:0;
it is then supposed to appear on every page you print off.
it seems to work on firefox alright, but doesn't work on IE6.0. you might want to give it a go though. ...seems like microsoft are doing their best to force everyone into upgrading to IE7 now, so i wouldn't image it will be a major problem for too long.
For example, If I hide headers and whatnot, then set the content to start at position:absolute 0, only one page of a multi-page printout gets printed.
I need to study up on it a bit more before declaring it a mess. I may very well be doing something wrong.
Here [webmasterworld.com] is a question I had asked in a similar vein.
if you hidden some divs header, sidebars etc for print.. you should use display: none, rather than visibility: hidden; and you shouldn't need to position the content you do want printed at all, just let it flow
Try setting
position:static; on elements to set the correct default. what some do is serve their screen stylesheet only to the screen media this makes it easier to write a print stylesheet, you're starting from a blank canvas with no positioning to override, only some divs to hide usually and a bit of font resizing/coloring
HTH
Suzy
I just need to spend more quality time with my CSS before I can definitively say what's up.
CSS is a major pain. I just made another post about the Webstandards Acid Test [webstandards.org].
CSS is a major painNo it's not, CSS is great!
I wouldn't be using it if I din't think it was.
CSS isn't the problem. As the acid test [webstandards.org] shows, the problem is with browser incompatibilities.
In a perfect world, CSS would be quite easy. In the real world; not so.
I have written million-line programs in C++, Pascal, Assembly, etc. I've written async device drivers and debugged protocol streams with protocol analyzers and other tools.
Reliable, cross-browser CSS presents as much of a challenge as any of these.
Nevertheless, I do agree with you that it is great, but way too many designers neglect to test it on multiple browsers.
If you really want to see some kewl CSS stuff, check here [cssplay.co.uk].