在CSS中指定打印的细线粗细 [英] Specify hairline thickness in CSS for printing

查看:836
本文介绍了在CSS中指定打印的细线粗细的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个打印CSS样式的元素:

If I have a print CSS styling an element with:

border:1px solid black;

或:

border:0.25pt solid black;

打印时线非常粗 - 至少1pt。如果我尝试一个更小的值,如0.05pt,该行不会出现。如何获得细线?在像InDesign这样的程序中,您将厚度设置为0.25pt用于细纹,即非常细的线,但不能太薄,因此不能打印。

The line is very thick when it prints – at least 1pt. If I try a much smaller value, such as 0.05pt, the line doesn't appear at all. How can I get a thin line? In programs like InDesign you set the thickness to 0.25pt for a 'hairline', i.e. a very thin line but not so thin that it won't be printable.

注:这个问题似乎问同样的事情,但没有人解决了线厚度的实际问题,只是最好的使用单位:
pt或px指定打印边框宽度

Note: this question seems to ask the same thing, but nobody has addressed the actual issue of the line thickness, merely the best units of measure to use: pt or px for specifying border-width for print

推荐答案

感谢您的帮助。看来,浏览器在这方面是没用的。

Thanks for your help. It would seem that browsers are just useless in this respect.

我做了一些更多的测试,结论似乎是:

I've done some more testing and the conclusion seems to be:


  • 没有浏览器对打印点尺寸有任何好处。

  • 您不能假定用户将看到宽度小于1.25pt prinout。

我测试了以下网页的变体,每次调整边框点大小。我打印的适合页面已关闭。

I tested variations of the following web page, adjusting the border point size each time. I printed with 'fit to page' turned off.

<html>
  <body style="width:17cm; background-color:rgb(245,245,245);">
    <div style="border:0.3pt solid black; width:100%; height:20cm">IE 0.3pt</div>
  </body>
</html>

这些是最小可打印点大小的结果,以及与打印输出从InDesign。我还包括了一些其他笔记:

These are the results of the minimum printable point size and what it looks like compared to a printout of lines from InDesign. I've included a few other notes, too:

FF:0.25pt,看起来像1.25pt。 DIV宽度看起来像是17厘米,但由于FF的大量打印边距,右边框被切断。看来16.5cm是最大可用宽度。 BODY高度适合页面高度。

FF: 0.25pt, looks like 1.25pt. DIV width looks like it is 17cm, but because of FF's massive print margins the right-hand border gets cut off. It seems 16.5cm is the largest usable width. The BODY height fits the height of the page.

Safari 5:0.75pt,看起来像1pt。 DIV宽度为18.2厘米,BODY宽度为19.5厘米 - Safari似乎适合页面,即使没有迹象表明它会这样做。 BODY高度在DIV高度后不久完成。

Safari 5: 0.75pt, looks like 1pt. DIV width is 18.2cm and BODY width is 19.5cm - Safari appears to be fitting to page even though there's no indication that it would do this. The BODY height finishes shortly after the DIV height.

Opera 11:0.4pt,看起来像0.75pt。 DIV宽度为16.2cm,BODY背景只出现在div中 - 虽然文本行出现在白色背景上

Opera 11: 0.4pt, looks like 0.75pt. DIV width is 16.2cm and the BODY background only appears within the div - although the line of text, appears on a white background

IE7:0.4pt,看起来像0.5pt (如0.5pt)。与FF一样,DIV宽度看起来像是17厘米,但由于IE的大量打印边距,右边框被切断。

IE7: 0.4pt, looks like 0.5pt (as does 0.5pt). As with FF, DIV width looks like it is 17cm, but because of IE's massive print margins the right-hand border gets cut off.

IE9:0.1工作低),但仍然看起来像0.5pt。否则与IE7相同。

IE9: 0.1 works (and possibly lower), but still looks like 0.5pt. Otherwise same as IE7.

这篇关于在CSS中指定打印的细线粗细的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆