I'm using Zurb Foundation. I'm trying to print a page exactly as it looks in large screen but everything get stacked (and floated wrong).
I succeded in having the grid in the printing page by substituting every "screen" occurrences with "print, screen" in the foundation.min.css.
The problem is that the grid taken now is the small one.
I read this post on the foundation support but honestly I don't know exactly what I'm supposed to do. Do I need to recompile foundation with sass?
http://foundation.zurb.com/forum/posts/412-printing-paper-copies-of-site-built-on-foundation
Whats should I do? Thanks.
Follow @Hashem Qolami's answer, but need a small change in for loop because for some reason it doesn't calculate the percentage value for columns and also the
gridCalc()
already deprecated (line #22) in Foundation 5. So you should use thegrid-calc()
instead or much better if you calculate the percentages directly withpercentage()
:It will do the basic things but need more hacks if you created a custom HTML structure with some tricks.
Set the width for the whole html to large size:
And finally in the
_settings.scss
(around line #82) set the$screen
value from"only screen"
to"only print, screen"
:These three sass loops have made my life easier when styling pages for print and have worked like a charm.
The variable $total-columns comes from foundation's core settings.
Here is the CSS for that:
Source: http://foundation.zurb.com/forum/posts/2820-printing-foundation-5
Well, yes. You need to create a custom sass file and put the print rules inside that. Then recompile the file with Sass compiler.
Inside the
scss/
folder you have these twonormalize.scss
andfoundation.scss
files. Create a new file namedapp.scss
and import the normalize and foundation as follows:And then put the below code snippet at the end of
app.scss
file as suggested by Rafi Benkual:Note: This may or may not work. I didn't try this myself. However it's deemed helpful at Foundation Forum.
The
$total-columns
variable is defined inscss/foundation/components/_grid.scss
file, which you can override that (as the other settings) by editingscss/foundation/_settings.scss
. Hence you need to import@import "foundation/settings";
before the foundation file.Finally, compile the
app.scss
file by:sass --watch app.scss:app.css