printing div problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • moonman
    New Member
    • Sep 2007
    • 1

    printing div problem

    I'm not very good at css but from what I've read it is possible to print the content of a scrolling div. I have tried everything with no luck. From what I've found using a css for the print should work but doesn't seem to. Anyone know what I'm doing wrong?

    <style type="text/css">
    @media print
    div#scroll{heig ht:auto;
    font-size:12px;
    overflow:visibl e;
    }
    </style>
    <body>
    <div id="scroll" style="border: 1px solid #000000; overflow: hidden; width: 600px; height: 310px">
    <div style="padding: 20px 10px; overflow: auto; width: 600px; height: 310px">
    large amount of stuff
    large amount of stuff
    large amount of stuff
    </div>
    </div>
  • phvfl
    Recognized Expert New Member
    • Aug 2007
    • 173

    #2
    Originally posted by moonman
    I'm not very good at css but from what I've read it is possible to print the content of a scrolling div. I have tried everything with no luck. From what I've found using a css for the print should work but doesn't seem to. Anyone know what I'm doing wrong?

    <style type="text/css">
    @media print
    div#scroll{heig ht:auto;
    font-size:12px;
    overflow:visibl e;
    }
    </style>
    <body>
    <div id="scroll" style="border: 1px solid #000000; overflow: hidden; width: 600px; height: 310px">
    <div style="padding: 20px 10px; overflow: auto; width: 600px; height: 310px">
    large amount of stuff
    large amount of stuff
    large amount of stuff
    </div>
    </div>
    Hi Moonman,

    Welcome to TSDN...

    Try putting braces around the styles so that the style element reads:
    [HTML]
    <style type="text/css">
    @media print{
    div#scroll{
    height:auto;
    font-size:12px;
    overflow:visibl e;
    }
    }
    </style>
    [/HTML]

    Comment

    Working...