How to hide content on printing with MVC and Javascript?
With the information you've provided, I can't see any reason why the print media queries wouldn't execute and prevent the menu from being printed. Take a look at the fiddle that exposes this markup:
<td style="max-width: 100px;">
<a href="javascript:window.print()" class="btn btn-default">Print</a>
</td>
<div style="top:120px;left:10px;position:absolute;" class="no-print">
Won't print this!
<span>Or this!</span>
</div>
It shows the basic elements you provided, and printing appears to hide the elements correctly.
Could you provide a little more detail? Maybe something else is going on that's exposing those elements or maybe the CSS hasn't been saved- something along these lines.
Hide buttons when printing
You can use CSS @media
queries. For instance:
@media print { #printPageButton { display: none; }}
<button id="printPageButton" onClick="window.print();">Print</button>
Related Topics
Transitions on the CSS Display Property
Remove White Space Below Image
Css3 Background Image Transition
Better Way to Set Distance Between Flexbox Items
How to Get Ff 33.X Flexbox Behavior in Ff 34.X
How to Vertically Center ≪Div≫ Inside the Parent Element With Css
The Difference Between Percentage and Fr Units
Vertical Align Middle in ≪Div≫
Should I Avoid Using !Important in Css
What Does a Space Mean in a CSS Selector? I.E. Difference Between .Classa.Classb and .Classa .Classb
How to Center Floated Elements
How to Make Background-Size Work in Ie
How to Apply Multiple Transforms in Css
Css '≫' Selector; What Is It
Remove Blue Border from CSS Custom-Styled Button in Chrome