Jump to content

Printing a Web page


mmc6e

Recommended Posts

You could do that, but there is a more elegant option. You can define styles to be different based upon he output. So, you can set the "print" display property of the button to be none when the page is printed vs. in-line when it is viewed in the browser.

 

Put the content in a div (with a class, e.g. 'printDiv') and use some CSS like this:

 

@media print {
    .printDiv { display: none; }
}

 

The content will be displayed in the browser but not in the print output - you can test using Print Preview in your browser.

Link to comment
https://forums.phpfreaks.com/topic/278942-printing-a-web-page/#findComment-1435047
Share on other sites

  On 6/10/2013 at 8:39 AM, Christian F. said:

 

What I showed was a use of Media Types. Media Queries is a feature to extend the functionality of Media Types. As I understand it, Media Queries can be used to apply different styles based upon specific attributes of the output device. For example, you could have a specific style sheet when the output is Color vs. Black & White (most relevant to print output I would suppose.). You could also have different outputs based upon the resolution of the output device. This is probably one of the biggest advantage. Media Types allows for type called "handheld", but that was defined many years ago before the proliferation of "handheld" devices (of varying sizes ) we have today. There isn't always a one-size-fits-all approach for "handheld" devices. The output that works best for a large tablet won't work well for a smartphone. Then you have the in-between sizes such as the iPad mini. Based on this page (http://caniuse.com/css-mediaqueries) Media Queries are just now supported in all major browsers whereas Media Types have been around for about a decade.

 

I wasn't even aware of Media Queries. I think I'm going to have to play around with those.

Link to comment
https://forums.phpfreaks.com/topic/278942-printing-a-web-page/#findComment-1435155
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.