Print html from rmarkdown exactly as it appears on the screen

We generate HTML documents from rmarkdown. The documents look as expected on the monitor; however, in rare occasions we wish to print them, and many elements are not printed as they appear. For example: red text appears black, and "hr" elements do not appear. Is there a simple way to embed in html that the printed files should look exactly as they appear on the monitor?

If you are printing with chrome, you need to make sure that the print CSS is not overriding some of your custom style. You can also configure a custom CSS for print.

Maybe this resource can help

Thanks for the reply. We do not want to do it "à la carte" for each element. We just want to inherit and print everything exactly as it appears on the monitor. We could not find anything simple to achieve that.

Can you then provide an example of this document ?

What I am trying to explain is that when printing, special CSS rules will apply. The link I shared is to help debug and find the rules that is not applying to print mode, and why.

Once identified we can then know what to do. It could be a user's CSS rule, a Bootstrap's Rulle, a R Mardown internal CSS rule, a Pandoc's CSS rule...

You see that this is several place this could be. I need more element to solve.

I don't know if you search around, so you may already have seen that, but here is a related problem because of Bootstrap own rules

Using bootstrap v4 solves it. Maybe this what you encounter.

Hope it helps