Quantcast
Channel: How to print scrollable DIV content - Stack Overflow
Viewing all articles
Browse latest Browse all 7

Answer by DavidTaubmann for How to print scrollable DIV content

$
0
0

Make all parents visible

I've struggled some hours with this and finally noticed the problem was that some of the parent tags where preventing the div to be fully visible, and instead a scrollbar from some parent tags was being visible on the print.

So the final effective solution was to apply all the rules (mentioned in other answers) to all possible parent tags that could be in the middle, including also an !important rule so they wouldn't be bypassed.

Like this:

@media print {  body, .CLASS-of-parent-tag, #ID-of-div-with-long-content {    display: block !important;    position: relative !important;    width: auto !important;    height: auto !important;    overflow: visible !important;    margin-left: 0 !important;  }}

This applies for almost any case in my projects.


Viewing all articles
Browse latest Browse all 7

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>