@Media Print CSS

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



Leave a reply



Submit