Anatoly Lubarsky

Logo
MSSQL, .NET, Design. Life and Music

Media Print Style Sheet Example

One of the most important features of style sheets is that they specify how a document is to be presented on different media: on the screen, on paper, with a speech synthesizer, with a braille device, etc. This is a simple example of style sheet for print media.


@media print 
{
    @page       { margin: 10%; }
    h1, h2      { page-break-after: avoid; page-break-inside: avoid; }
    pre         { page-break-inside: avoid; }
    ul, ol, dl  { page-break-before: avoid; }
}

Pay attention to margin and page-break styles.


Related Posts:

Thursday, May 13, 2004 4:59 AM

Comments

# re: Print with css
Any example, how to use this in html page?

7/7/2004 7:24 PM by guoqi

# re: Print with css
guoqi: you don't need to change your html at all, it is supposed to work just fine via css :)

7/8/2004 1:01 AM by Anatoly Lubarsky

If your feedback doesn't appear right away, please be patient as it may take a few minutes to publish.

Post a Comment

Protected by CAPTCHAEnter the code you see
Name (*)  
E-mail (*)  
Url
Remember

Comment (*)