How to change font?

I am trying to change the font and I searched forums. Everyone advises to change it in obsidian.css but I can’t find it anywhere. Can you show me the exact location of that file? (Windows 10)

Here’s what I do:

  • Open Obsidian’s Options menu

  • Select “Appearance” tab

  • Under CSS Snippets, select “Open snippets folder” icon

  • Create a blank text file in that folder with the suffix “.css” (“My Font.css”, for example)

  • Type the following 4 lines (switch “Times New Roman” to any font you wish) (use regular single quotes, not the fancy quotes this forum software corrects it to):

    {
    font-family: 'Times New Roman', serif !important;
    }
  • Save the file

  • Back in Obsidian, click the “Reload snippets” icon

  • Now you can activate your font setting (snippet) for any theme!

8 Likes

Thank you that worked.

That didn’t work for me. Any other ideas please?

Is it possible to use different fonts in the view mode vs. editor mode in a similar way?

I know there are designs themes like “minimal” but they come with other disadvantages…
Usually good typography design rules are asking for serif-fonts in view (read) mode.

So I’d like to have the following results after applying the changes…

  • editor-mode fonts:
  1. Textbody: sans serif font of my choice + size adjustable
  2. Sourcecode: sans serif font of my choice + size adjustable
  • preview-mode fonts:
  1. Textbody: serif font of my choice + size adjustable
  2. Sourcecode: sans serif font of my choice + size adjustable

This helps to:

  • recognize immediately in which mode your openend document is - edit or view…
  • makes longer documents better readable in preview mode (typo rules!)
  • allows you to safe screenspace in editor mode by modifying the Fontsize and fonttype

Thx for your help

Hi there,

I started using playing around with Obsidian and I’m trying to figure out how to change the font in both preview and edit mode.
The CSS file in Snippets didn’t work for me. I put the following in the file, but no results:
{
font-family: ‘Times New Roman’, serif !important;
}

Any ideas?
Thanks.

Hello, @aalonso. Did you activate the snippet? If not, go to appearance. Under CSS Snippets, check the box to activate it. Hope that helped.

Hi, thanks for your answer. Yes, I activated the snippet and also restarted Obsidian. No results.

Assuming you have the stock Obsidian theme, try this:

:root {
--default-font: ‘Times New Roman’, serif;
}

Be sure to activate it. If it doesn’t work, then use !Important; after serif.

1 Like

It worked, BUT I’m finding Times New Roman small. So, I’d tried to change to Palatino Linotype and it doesn’t work. Any ideas? One more thing: I’m using a theme called Blue Topaz (dark mode) and I like to keep the original fonts for everything (headings etc.) but the normal level text (the main text of the note). Is there a way to implement such a change?
Thanks once more.

There is a text size slider under the appearance tab you could use. However, each installable theme has its own CSS for making more minute changes. I’m not familiar with the options for Blue Topaz, although it’s a beautiful theme. Until you’re more comfortable editing CSS, perhaps you might consider something like “ITS Theme.” It has a considerable range of custom settings through the Style Setting plugin, including those necessary for making font size adjustments to your hearts content.

It worked with ITS theme (not with Blue Topaz). Thanks for your help and pacience.

Today I successfully changed the font using a custom CSS file. However, I had to resorted to use the “Toggle Developer Tools” to inspect the DOM.

With Obsidian default theme, to change the font:

/* Set fonts for both Edit and Preview mode
.view-content {
  font-family: 'Courier New', monospace !important;
}
*/

.markdown-source-view {
  font-family: 'JetBrainsMono Nerd Font', Menlo, Monaco, 'Courier New', monospace !important;
}

.markdown-preview-view {
  font-family: Lora, sans-serif !important;
}

Please make sure that you activate the snippet under Settings > Appearance > CSS snippets.

4 Likes

thank you for sharing! for some reason, my old .css file to change font didn’t work.

A bit late to the party, but for people stumbling upon this thread:

I am using the solution provided by @Genzer

I found the serif fonts to be a bit too small as well and I scaled them up like so:

.markdown-preview-view {
  font-family: "TeX Gyre Pagella", sans-serif !important;
  font-size: calc(var(--editor-font-size) * 1.2);
}

In my case, this approx. matches the source editor font.