SHARE

@ media print query is used as print format of webpage.Common causes of error @ media print style sheet not working.Print media style used with three ways, inline style,external print media style sheet or create @ print media query in common style sheet.

Common cause for @ print media style sheet not working

  1. @ media print style sheet is not properly linked with webpage.
  2. print styles are controlled by any internal module,plugin or script.
  3. @ media print attribute is not valid
    Solution: error @ media print Style sheet Not Working
    Solution: error @ media print Style sheet Not Working

    Solution: error @ media print Style sheet Not Working

Solution for @ print media styles

Soution 1 :Check if your print media style sheet linked with webpage properly or not.Link tag is closed properly and looks link as follows.This type of link used only if you want to use separate style sheet for print media.

<link rel="stylesheet" type="text/css" href="css/print.css" media="print" />

Solution 2: If print media styles are controlled or executed by internal scripts,plugin or module . In that case @ media print style sheet not overwrite styles.To overwrite styles and load style of @ media print query use ( ! important; ) .For example in you media print style sheet “div ” height is 200px but this style is not working.

@media print {
    .div { height:200px; }
}

Now change your code as following and add ( ! important ) in it.

@media print {
    div {height:200px !important;}
}

With this way you can overwrite the style of div.

Solution:3 In the third situation of error @ media print style query because of your media attribute is not right.If you are using conman style sheet for all media types then check link tag.

<link rel="stylesheet" type="text/css" href="stylesheet.css" media="screen" />

In the above tag “media” attribute value is “screen”.This can also create error @ media print style loading. Delete media=”screen” from the link tag.

<link rel="stylesheet" type="text/css" href="stylesheet.css" />

After all changes clean cache of browser, reload web page and try to print the web page.