@page Css style doesn't work for Mozilla firefox

My requirement is to print 10 cm on the whole page when printing .

I type using window.print(). My webpage will dynamically increase (so the number of pages cannot be determined). For all pages I need to provide a size of 10 cm.

I used CSS Media="Print"in which I defined the style:

  @page
  {
     Margin-top :10cm; 
  }

This works in all browsers except Mozilla firefox . I was looking for solutions, and all blogs say that Mozilla does not support @page, but without a solution. Can someone help me with this? Please let me know if it is possible to implement in mozilla

+5
source share
2 answers

, , , google, .

(https://developer.mozilla.org/en-US/docs/Web/CSS/@page), Firefox 19.0, , ...

+3

@document moz @-moz-document Firefox

@-moz-document - , Gecko, , , URL- . . @-moz-document . - URL-, URL-.

:

@-moz-document url(http://www.w3.org/),  
           url-prefix(http://www.w3.org/Style/),  
           domain(mozilla.org),  
           regexp("https:.*")  
{  
  /* CSS rules here apply to: 
     + The page "http://www.w3.org/". 
     + Any page whose URL begins with "http://www.w3.org/Style/" 
     + Any page whose URL host is "mozilla.org" or ends with ".mozilla.org" 
     + Any page whose URL starts with "https:" */  

  /* make the above-mentioned pages really ugly */  

     @media print{
         body { margin-top :10cm; }
     }       
}  

:

  • url(), URL
  • url-prefix(), , URL-
  • domain(), , URL- ( )
  • regexp(), , URL- . URL-.
0

All Articles