1

should i use pt or px when specifying border-width in css for media print?

i basically just want hairlines

knittl
  • 246,190
  • 53
  • 318
  • 364

3 Answers3

1

For print you should use pt, as it's an absolute unit not based on the resolution of the media.

Guffa
  • 687,336
  • 108
  • 737
  • 1,005
  • 1
    That's the "correct" answer but the truth is a little more complicated. Browsers have methods to make pages print even when coded incorrectly with `px` units and other crazy stuff. You may find that it's simpler and better to be lazy like everyone else. For example, with Chrome, lines set with `pt` widths smaller than `.8pt` will not show up on screen or printed. However, on IE, they will show up as `1px` on screen, and the correct size when printed (insofar as the printer DPI allows). – brentonstrine Nov 27 '12 at 20:13
0

In general you should use points or em's in place of pixels when possible. The reason is that points and ems both scale with the users' resolution or zoom setting where pixels do not. On many larger, high definition or wide screen monitors individual pixels are too small to be reliably useful for placement.

g.d.d.c
  • 46,865
  • 9
  • 101
  • 111
  • i'm talking about printing on paper, no screen/pixels involved. that's why i asked this question – knittl Jul 06 '10 at 14:12
  • Do you know what kind of resolution your printer is going to be using? You can certainly use pixels if you're going to print media, but a 600dpi Printer will produce different output than a 300dpi printer with a single pixel border. – g.d.d.c Jul 06 '10 at 14:20
  • 2
    Pixels may scale; they are not always exactly one physical pixel—see CSS 2.1 section 4.3.2. A 600dpi printer will not convert `1px` to 1/600″, and extremely-high-def monitors also scale. The page ‘zoom’ feature by design zooms pixels as well as every other unit. Also `pt` is just as unresponsive to text size settings as `px`; it should only ever be used for print. – bobince Jul 06 '10 at 15:00
-2

for hairlines use just px

Salil
  • 46,566
  • 21
  • 122
  • 156