Final answer:
To create a CSS media query for printing, use the 'at the rate of media print' rule. Inside this rule, define the styles that should apply when the document is printed, such as setting text color to black and background to white, and hiding elements not needed in the printout.
Step-by-step explanation:
To program a CSS media query that is triggered only when the page is being printed, you need to use the at the rate of media print rule. This rule applies styles only when the document is being printed. Here is a basic example of how to use it:
at the rate of media print { body { color: black background: white; } .no-print { display: none; }}
In this example, the body will have black text on a white background when printed, to ensure maximum readability and save printer ink. Also, any element with the class .no-print will not be displayed in the printout. You can add other styles within the at the rate of media print block to further customize the print version of the page.