Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8857257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:32:49+00:00 2026-06-14T14:32:49+00:00

Im using firefox 16.0.2. I would like to print a div content with the

  • 0

Im using firefox 16.0.2. I would like to print a div content with the css rules defined in the imported file. When trying to print in Chrome, it’s work fine, but in Firefox, the printed page got no css formatted.

<html>
    <head>
        import css here
    </head>
    <body>
        <div id="printable"></div>
    </body>
</html>

When using javascript to print div id=printable, paper result only have a HTML content without CSS rules, the result on screen is perfect. Is there any way for Firefox print with all css defined, any help will be appreciated.

Addition below is my javascript to print div

function print(id) 
{
    var mywindow = window.open('', id, 'height=600,width=800');
    var data = document.getElementById(id).innerHTML;
    mywindow.document.write('<html><head><title>Print</title>');
    mywindow.document.write('<link rel="stylesheet" href="../../lib/css/report/main.css" type="text/css" />');
    mywindow.document.write('</head><body >');
    mywindow.document.write(data);
    mywindow.document.write('</body></html>');


    mywindow.print();
    mywindow.close();

    return true;
}

In main.css I try to use @media print {#printable…..} but it’s not works. In Javascript I try to put media=”print” to link tag like but it’s still nothing effect to print preview.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:32:50+00:00Added an answer on June 14, 2026 at 2:32 pm

    Why don’t you use a print specific media query instead?

    @media print {
       #printable {
         /*Print style goes here*/
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using firefox 5 when i run window.getComputedStyle(document.getElementsByTagName(img)[0], null); I get the complete css file,
I'm using Firefox and I've been reading some forums claiming this doesn't work in
When I upload a jar file to my web server, people using Firefox or
I'm using Selenium RC with chrome-mode for Firefox to automate test cases for a
I am trying to write an API for a mobile application. I would like
I would like to create a drop down menu on rails 3.2.8 using bootstrap
I am using ff-activex-host to host a .NET ActiveX control in Firefox and Chrome.
I would like to change the address bar background in either Firefox or Internet
I would like to have a clean up of my Firefox favorites as its
I have a dual column layout using CSS: <div id=nav></div> <div id=left_column></div> <div id=right_column></div>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.