Is there a way to enable media print css to a normal view?
In addition to Boldewyn's answer, if you have @media print
styles inside <style>
tags, you can replace them with @media screen
:
Array.prototype.forEach.call(document.getElementsByTagName('style'), function(style) {
style.innerText = style.innerText.replace(/@media print/gi, '@media screen');
});
See the demo.
css print media query prints only first page
Try this:
edit: using position absolute. Realized that position:fixed only creates one page since thats how it works (you cannot scroll with position:fixed). Absolute does the same thing but is expandable.
@media print {
body * {
visibility: hidden;
}
#divname, #divname * {
visibility: visible;
}
#divname {
left: 0px;
top: 0px;
position:absolute;
}
p {
page-break-before: always;
}
}
.para {
font-size:x-large;
height:3000px;
}
Printing using JS and @media print CSS but content pushed down
visibility: hidden;
will "hide" those elements in the sense that their contents are hidden. But the space they occupy without that rule will still appear as empty space, which I suppose is what you are referring to.
Use display: none
instead, which will actually hide the affected elements and not leave any empty space.
@media print css not formatting table on printing
You can use different styles for screen and print media in your style sheet, i.e.
@media screen
{
table.test {
font-family:"Times New Roman",Georgia;
font-size:10px;
// more
}
}
@media print
{
table.test {
font-family:Verdana, Arial;
font-size:10px;
// more
}
}
When you'll print the table only styles defined in print media will be applied.
Click This for more
Related Topics
Send Form by Email and Track Responses in Spreadsheet
Applying CSS Styles to All Elements Inside a Div
Bootstrap Row and Col Explanation
How to Use Custom Fonts in an HTML5 Canvas Element
How to Get Rid of X and Up/Down Arrow Elements of a Input Date
CSS Position Element "Fixed" Inside Scrolling Container
How to Make an <Audio> File Play Continuously on All Pages
Why Certain Doctype Declarations Cause 100%-Height Tables and Divs to Stop Working
CSS Making Two Divs Equal Height with Display Table
Adding Double Quotes to a Paragraph with CSS
Advantages and Disadvantages of Using Base64 Encoded Images
Change CSS Font-Family for Separate Options in Select Tag
How to Stretch a Background Image to Cover The Entire HTML Element
How to Detect HTML5 Audio Mp3 Support