peterdesmet / petridish

Jekyll theme for research project websites 🧫
https://peterdesmet.github.io/petridish
MIT License
49 stars 44 forks source link

Add print.css #95

Open peterdesmet opened 8 months ago

peterdesmet commented 8 months ago

As reported by https://github.com/tdwg/website/issues/524, more could be done to make Petridish websites print friendly. There are two main approaches:

  1. Add a assets/css/print.css (or scss) and call it in head with:
<link rel="stylesheet" media="print" href="{{ '/assets/theme/css/print.css' | relative_url }}">

Use https://tdwg.github.io/ltc/static/custom/css/print.css as inspiration. The advantage is that all print related elements are together. The disadvantage is that when updating a certain element (like the navbar), it is easy to forget the print related changes too.

  1. Add @media print rules in context:
/* override styles when printing */
@media print {

  body {
    margin: 0;
    color: #000;
    background-color: #fff;
  }
}

The advantage is that all css is kept in context.

I think I prefer the latter approach. If done so, than https://github.com/peterdesmet/petridish/commit/efb9a64438086376f9f36dd8df6cd93caefa9aa9 could be updated to make use of @media elements.

ben-norton commented 8 months ago

I think either solution works. Since you are the person that will be completing the task, you should be able to chose your preferred solution. :)