Is an easy way to change font in default or custom css style?

Simon's Avatar

Simon

01 Mar, 2019 07:58 AM

Hi

I'm using Marked 2 to export to PDF. I have both the default .css styles and some custom made styles that I have downloaded for Github. I wanna be able to change between different the styles before I export my document and at the same time wanna be able to see the same font (Times New Roman 12 pt) in all style templates I using both in Marked 2 and into the final PDF file.

What's the easiest way to do this? At the moment I have used the Additional CSS box under "Theme" and writing this:

div {
  text-align: justify;
  text-justify: inter-word;
}

p.serif {
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
}

The text-align command works like a charming but the p.serif don't make any difference in the document or into the final PDF file. I'm not good with HTML.

Grateful for help

Thanks.

Simon

  1. Support Staff 1 Posted by Brett on 01 Mar, 2019 02:50 PM

    Brett's Avatar

    There is no "serif" class applied to paragraphs, so you need a different selector on the rule. Specificity will help. If you want to change all fonts in the page to Palatino, you would use something like this in the Additional CSS box:

    #wrapper {
      text-align: justify;
      text-justify: inter-word;
    }
    
    #wrapper * {
      font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif!important;
    }
    

    That would change the font of every element in every theme to Palatino. Note that I changed div to #wrapper as well to prevent the style from affecting Marked's own elements (like the Table of Contents, etc.). You also need the !important to ensure it overrides any more specific font declarations in a given theme.

    If you only want to change the font in your custom themes, it would be a little different. If you want help with that, attach a copy of the theme file and I'll help you modify it.

    -Brett

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac