---
title: "css @media print not working"  
description: "css @media print not working"  
author: "Anonymous User"  
published: 2013-04-10  
updated: 2013-04-15  
canonical: https://www.mindstick.com/forum/756/css-media-print-not-working  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# css @media print not working

Hi Everyone!\
I [am trying](https://answers.mindstick.com/qa/36834/which-two-programming-languages-should-i-master-in-if-i-am-trying-to-get-into-google-or-facebook) to change [style](https://www.mindstick.com/articles/126300/apa-citation-style-get-to-know-about-it-for-your-next-assignment) of printed [document](https://www.mindstick.com/articles/328642/what-to-consider-while-choosing-a-software-documentation-tool) using css (@[media](https://www.mindstick.com/articles/44257/the-impact-of-social-media-on-lawsuits) print) and have defined a [simple](https://yourviews.mindstick.com/story/1469/5-simple-ways-to-stay-fit-amp-healthy) style to change the [heading](https://yourviews.mindstick.com/view/83418/is-india-heading-towards-civil-war) fontsize while printing. However the style for print media is not changed at all. Could [anyone](https://www.mindstick.com/articles/23207/how-to-find-the-best-fit-job-for-anyone) tell where I [went wrong](https://answers.mindstick.com/qa/94671/how-do-i-create-a-google-account-when-the-page-keeps-showing-me-a-message-that-something-went-wrong)? Thanks! Here's what I did\

```
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="testmediacss.aspx.cs" Inherits="PrintDemo1.testmediacss" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server">    <title></title>    <style type="text/css" >   @media print { body {font: 50pt Arial;} h1 {font-size: 138pt;} h2 {font-size: 15pt; color: #000;} }    </style>    <script type="text/javascript" language="javascript">        function CallPrint(strid){            var prtContent = document.getElementById(strid);           var WinPrint = window.open('', '', 'letf=1000,top=1000,width=1000,height=500,toolbar=0,scrollbars=0,status=0');           WinPrint.document.write(prtContent.innerHTML);            WinPrint.document.close();            WinPrint.focus();            WinPrint.print();            WinPrint.close();       }  </script></head><body>    <form id="form1" runat="server">    <div  id="divprint">        <p>hello this is the part to be printed in the printer.</p>        <h1>hello world</h1>        </div>        <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="CallPrint('divprint');" />    </form></body></html>
```

\
Thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)!

## Replies

### Reply by AVADHESH PATEL

Hi Jacob!\
I have always used both media print and media screen when defining css.\

```
@media print{  h1 {font-size: 138pt;}}@media screen{ h1 { font size: 95pt;}}
```

It will show up on the screen as 95 point text, but print as the 138 point text.


---

Original Source: https://www.mindstick.com/forum/756/css-media-print-not-working

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
