How to apply CSS to editing and reading view?

What I’m trying to do

Hello! I’m new to Obsidian’s CSS and CSS in general. I’m currently trying to apply custom paragraph spacing to editing and reader view.
I’ve browsed the forum for solutions to this issue, but all the solutions I’ve encountered only apply to editing mode. I did encounter a question similar to mine, but it was about headers. Nonetheless, I tried to tweak the code for my purposes. It did not work out.

Things I have tried

This was my latest attempt

.markdown-source-view :is(.cm-line + .cm-line),
.markdown-rendered {
padding-top: 1em;
}

I do plan to read into the CSS more, but I really just want to fix this.
Thanks in advanced!

I usually use:

  • source view: .markdown-source-view:not(.is-live-preview)
  • live preview: .markdown-source-view.is-live-preview
  • reading view: .markdown-reading-view

If you want to apply to .cm-line + .cm-line for both .markdown-source-view and .markdown-rendered, you must write

.markdown-source-view,
.markdown-rendered {
    .cm-line + .cm-line {
        padding-top: 1em;
    }
}
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.