Print the page

I am having a page where when the button is clicked the page will be printed. I am using the below line on the "On Click" extended proprties.  Now the problem is It prints the whole page for example the Titile,Menubar, Login Info everything. how ca I omit those and to print whatever is on the Maincontent. Any help is greatly appreciated. Thanks
"window.print(); return false;"
Use media queries in your css.
I am completely new. Can you tell me where do I use.
I tried adding the below in to the Style sheet of the Page that needs to be created.
@media print  { 
  div.Menu_Container, div.Login_Info, div.Footer, div.Sidebar_Block, div.Sidebar_BlockActions {display: none;}
But when I click print preview on the browser I see like below . It still has the header and the buttons. Also "There are no suf" added to the page on the top right corner

Is there any tutorial or samples which I can follow to check this. I am in real need.  Any help is greatly appreciated. Thanks