Replies: 2 comments 3 replies
-
For me, it was fixed after making the styles <p class="hidden print:!block">hello</p> <p class="print:!text-red-600">hello</p> Although I'm not sure why there's an inconsistency -- sometimes it'll work without it and sometimes it won't. |
Beta Was this translation helpful? Give feedback.
0 replies
-
For those looking to a tailwind4 answer, add this to your style.css: @custom-variant print (@media print); |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using a very vanilla tailwind setup, with a few colours as the only customisation. I have a section in a document that I only want to appear when rendering for print, that's styled like this, in accordance with tailwind docs:
This isn't working – it's always hidden. Other print-only styles don't seem to work either, for example this doesn't print in red:
But this is only hidden when printing:
I am generating PDFs using Spatie's BrowserShot, and using
emulateMedia('print')
, but I don't think that has anything to do with it as it also fails to heed these styles when I use a browser's built-in print function.Any idea why these print styles are not working?
Beta Was this translation helpful? Give feedback.
All reactions