#1115: Expose unprintable areas via CSS

Visit on Github.

Opened Jun 23, 2025

I'm requesting an early TAG design review of exposing unprintable areas via CSS.

Most printers have a small region along each edge of the page sheet which is unprintable, due to the printer's paper handling mechanism. See https://drafts.csswg.org/css-page-3/#page-terms

The size of these unprintable areas are available to applications (such as browsers) in most OSes, but currently it's not web-exposed. This means that authors have no means of confidently setting page margins to prevent content from getting clipped. This becomes a more obvious shortcoming for @page margin boxes for e.g. custom headers and footers. See https://drafts.csswg.org/css-page-3/#margin-boxes

Discussions

Log in to see TAG-private discussions.

Discussed Jun 30, 2025 (See Github)

Skipping.

Discussed Jul 7, 2025 (See Github)

Xiaocheng: This is an early design review. Motivation is that, when printing a page, we want to avoid areas that are not printable due to restrictions by the printer. Think their use case is solid. Adding this new API seems reasonable. Slightly increases fingerprinting surface.

Martin: Can sites really read back the value when it goes to a printer? Expect the answer to be no. All the interactions after printing are happening between the browser and the printer. Don't think that happens… do we know the format? The amount of pages?

Lola: If you are on a site that is about printing, maybe they have to give them the information.

Martin: That is in the page setup instructions in CSS, but it's all static between HTML and CSS.

Christian: Think there's a beforeprint event which you can use to change stuff before the site is printed, need to check.

Xiaocheng: Discussion may be a bit off-topic. Is this really a privacy threat? Don't think so. Comparable to safe-area-inset. Would also be part of the fingerprinting surface.

Martin: You can read this back, but I'm not sure if it's entirely reliable. The rules for which stylesheet applies only gives you one shot per print, so it may not be worthwhile.

Lola: Propose Xiaocheng leaves a comment. It's worth asking them about potential alternatives. Think we can resolve this as satisfied if everyone's happy.

Martin: Think they've discussed multi-page prints. … Think that's a good sign.

Xiaocheng to post a comment that we're positive with their direction.

Discussed Jul 21, 2025 (See Github)

Xiaocheng: Posted a comment, and they immediately replied.

… Posted that we are generally positive, provided an alternative, they've responded with why the alternative doesn't work

… Since it's an early review, we could close it as satisfied. I believe we're on the right track.

… We want to see more alternatives explored while they are developing this.

Comment by @xiaochengh Jul 24, 2025 (See Github)

Hi @mstensho, the TAG discussed this and are generally positive due to the strong use cases.

We are wondering if less bad alternatives (compared to the one in the explainer) have been explored. For example, instead of introducing a new API, how about making safe-area-inset-* at least the unprintable inset on paged media?

Comment by @tabatkins Jul 24, 2025 (See Github)

Additionally, drafts.csswg.org/css-env-1#safe-area-insets says:

Well, that's just to clarify how they should work by default on computer screens. We can just remove/edit that.

Comment by @xiaochengh Jul 25, 2025 (See Github)

Thanks for the response @mstensho!

The TAG agree that the motivation is strong and the existing APIs are inadequate. Exposing some minimal information of the printer (in)abilities via CSS env() should be the right solution. We also encourage exploring more alternatives while iterating on the design of the API.

Since this is an early review, we are closing it as satisfied for now.