2007-09-11

web页面打印

关键字: 页面打印,打印HTML

打印属性

打印HTML文档总是会出现问题。在CSS2中,我们可以借助打印属性让打印web内容更容易一些

属性

描述

W3C

orphans

Sets the minimum number of lines for a paragraph that must be left at the bottom of a page

number

2

marks

Sets what sort of marks should be rendered outside the page box

none crop cross

 

page

Sets a page type to use when displaying an element

auto identifier

2

page-break-after

Sets the page-breaking behavior after an element

  • auto

  • always

  • avoid

  • left

  • right

2

page-break-before

Sets the page-breaking behavior before an element

  • auto

  • always

  • avoid

  • left

  • right

2

page-break-inside

Sets the page-breaking behavior inside an element

  • auto

  • avoid

2

size

Sets the orientation and size of a page

  • auto

  • portrait

  • landscape

 

widows

Sets the minimum number of lines for a paragraph that must be left at the top of a page

number

2

 当然除了上述办法以外,我们还可以通过控制设备类型,针对不同设备读取不同样式.

Media Types    设备类型

Media Type
设备类型

CSS Version
版本

Compatibility
兼容性

Description
简介

all

CSS2

IE4+

用于所有设备类型

aural

CSS2

NONE

用于语音和音乐合成器

braille

CSS2

NONE

用于触觉反馈设备

embossed

CSS2

NONE

用于凸点字符(盲文)印刷设备

handheld

CSS2

NONE

用于小型或手提设备

print

CSS2

IE4+

用于打印机

projection

CSS2

NONE

用于投影图像,如幻灯片

screen

CSS2

IE4+

用于计算机显示器

tty

CSS2

NONE

用于使用固定间距字符格的设备。如电传打字机和终端

tv

CSS2

NONE

用于电视类设备

 

 

 

 


*注:  倘若是需要页面全部输出打印,则需要代码

 
  1. <link rel="stylesheet" type="text/css" media="screen,projection"
  2.       href="css/aboutus.css" />  
  3. <link rel="stylesheet" type="text/css" media="print" href="css/print.css" />  

为代码

 
  1. <link rel="stylesheet" type="text/css" media="all" href="css/aboutus.css" />  

然后

IE->工具->Internet选项->高级->打印    选中打印背景颜色和图片,这样就ok啦!

评论
发表评论

您还没有登录,请登录后发表评论

tiger.passion
搜索本博客
我的相册
636a5d3f-1fce-3bb9-89d8-b13e5c6318d4-thumb
w3c01
共 46 张
存档
最新评论