Library of common custom CSS

Would anyone be interested in compiling/sharing custom CSS they use regularly? I have a few alterations I make on most PDF exports.

I’ve been meaning to compile them for my own uses, but I thought possibly others have similar alterations, and we could use the opportunity to swap, share, etc. I’m imagining like an index-type resource with sample code that can be copied easily.

Here are some examples of common changes I make to the basic themes for PDF exports:

  • reducing padding on textbox headers to keep page count lower for heavy users of textboxes
  • allowing page breaks in tables that are very large, so as not to cause a blank page prior
  • spacing adjustments for equations generated from LaTeX
  • setting “float on the next page” rules for images

Sound fun? Or does this exist already and I’m just reinventing the wheel?

Since a User group meeting recently reminded me of this conversation, here’s my latest time-saving CSS.

I had a text with a ton of images that all tended to overlap or all show up on separate pages. I started tagging them by shape using the CSS class option in the image options screen (so a student worker could do this work), and had corresponding code for each main shape category (I generally had tall, wide, or square).

This is an example of the CSS for the web version:

figure:has(img.tall){
 float:right;
  margin-right:-25%;
  margin-left: 1em;
  margin: 0 -25% 0 1em!important;
  clear:right!important;
}

And for the PDF;

img.tall {
    max-height: 325px;
    width: auto;
}

.wp-caption:has(img.tall), .wp-nocaption:has(img.tall) {
    float: inside;
  margin-outside: 1.5em!important;
  margin-inside: 0em!important;
   max-width: 25%;
   clear:inside;
    -prince-float-policy: in-order;
          }