How to have multiple css print layouts on a single page application?


Tags: javascript,html,css,single-page-application,printing-web-page

Problem :

I have a single page application, and I have different sections where I want to print out list of images each on it's own page.

I thought maybe to use iframe for this purpose, but I wanted to have an answer from someone experienced with this situation.

What is the best way to approach this problem?



Solution :

You can use CSS media queries to direct CSS rules at print time as described in this answer: How do I hide an element when printing a web page?.

You can then set different classes on some high level part object before printing to control which CSS rules apply and thus what gets printed in a given operation.

You can also have a whole stylesheet withe the media type set to print so it applies only when printing.

Or, depending upon the specific situation, you can open a new window, put the content to be printed in that new window and print that window. Usually, it's better to avoid opening a new window if you don't have to.


    CSS Howto..

    css - why my text box is not showing up?

    Css How to add round corners when hover li element?

    How to keep a flex item from overflowing due to its text?

    How to Make a materialize CSS button's width same as col s12?

    How to remove IconTabFilter icons using css?

    how to make div with image like below in html and css

    How to have a video take up the viewport height and width?

    jQuery - How to get all styles/css (defined within internal/external document) with HTML of an element

    How to extend background CSS styling indefinitely along the x-axis?

    How to remove unwanted white space in CSS

    How to override default Polymer CSS

    How to change only one function of CSS transform property w/ multiple functions?

    How to implement single-line ellipsis with CSS

    How to use ASP.NET Authorization Yet Permit Access to .css Files?

    How can I implement this dual-gradient menu design?

    How to group CSS/Javascript button behaviour? [closed]

    User agent, how to have diferent css files for diferent devices automaticly

    How to have responsive widths for labels and inputs using css

    Background-Image does not show properly on IE8

    how to set an element at fixed relative position in html rendering.? [closed]

    How to change 'inherited' font families using the CSS style sheet

    How to mail HTML/CSS output as attachment?

    How can i give transparency effect in CSS?

    Using javascript to show html on every page except one page

    How would you switch focus to an input text upon clicking an item on a dropdown menu?

    How do i wrap a parent div to the width of a child div (dialog)?

    Gulp callback - How to tell Gulp to run a task first before another?

    How can I make the ul contain li in its content box?

    How to make a scroll customization for mobile application?

    How to create a tag using css