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 8109133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:19:31+00:00 2026-06-06T01:19:31+00:00

When printing a page from a browser, it refers to a print.css stylesheet declared

  • 0

When printing a page from a browser, it refers to a print.css stylesheet declared with media="print". The browser disables some CSS rules like background-image and background-color, some browsers have options to enable them.

As told in this answer, it is not possible to override this behaviour from the page code.

I have two questions about this:

  • Is there any documentation or good reference about these printing rules ? For example:
    • Which CSS rules are disabled ?
    • Can Javascript do something on the page before printing ?
  • Is there a way to detect a browser in printing mode with Javascript and then make a graceful degradation system ?
  • 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-06T01:19:32+00:00Added an answer on June 6, 2026 at 1:19 am

    How browsers print pages is a bit of a black box; I haven’t been able to find any definitive references.

    All major browsers have print options to “shrink to fit” the web page to the paper page (enabled by default), and to print background images and colours (disabled by default). Most users will leave these defaults as-is, if they are even aware these options exist. I haven’t seen browsers “disabling” any other CSS rules when printing.

    Firefox and IE support the onbeforeprint and onafterprint events, so you can detect when printing is happening with JavaScript, though obviously this isn’t a cross-browser solution.

    Most adjustments needed for printing can be handled by CSS (either in a separate print stylesheet or as a @media print { ... } block in your main stylesheet):

    • The CSS-Discuss Wiki has a good page on how much you can control through CSS.

    • I suggest having a look at the print styles from HTML5 Boilerplate as a good starting point.

    • If you have background images that must be printed, you can include <img> elements in your page, hidden with display: none, then make them visible with display: block (or inline) in your print CSS.

    If you need to heavily modify the page for printing, I suggest offering a separate print-only version of the page, rather than trying to make adjustments with JavaScript.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been asked to provide some tricky printing functionality to a dynamicly generated page.
I'm printing to the screen lots of entries from my database. I'd like each
I'm printing a page of my PHP application with the ( ctrl + P
I have successfully implemented printing and print preview for my app using the PrintDocument,
How to format printing stmt in python? print--------------------------------- printclient:mount-point:logfile:status print--------------------------------- print clientname,mntpt,logfile,status Currently it
<html> <head> <style type=text/css> body { background-color: #000000; font-family: Arial, Helvetica, sans-serif; font-size: 20px;
<?php $url='http://edition.cnn.com/?fbid=4OofUbASN5k'; $var = fread_url($url);// function calling to get the page from curl $search
Trying to achieve the goal of printing selected page's element ONE-TO-ONE - the exact
When I print content using javascript, the browser automatically adds header and footer (url/date/pagenr).
The page I am working on has a javascript function executed to print parts

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.