buigui
January 19, 2024, 6:34pm
1
First, search the help docs and this forum. Maybe your question has been answered! The debugging steps can help, too. Still stuck? Delete this line and proceed.
What I’m trying to do
I would kike to add a 5px top and bottom padding to my body text
Things I have tried
In my obsidian.css file, I have tried codes such as :
.cm-s-obsidian {
padding-top: 5px;
padding-bottom: 5px
}
or
.cm-s-obsidian {
padding: 5px 0 5px 0;
}
Both above codes don’t work.
Yet below code works :
.cm-s-obsidian {
font-size: 18px;
}
Does anyone understand why or how I could make it ?
Thank you
ariehen
January 20, 2024, 12:27am
2
I think you may be looking for .cm-line
in the editor (source mode and Live Preview ). Have a look here to see if it seems similar: Can't get custom CSS to work - #15 by adrienneteicher
Live Preview with the adjustment:
Adjusting .cm-line
will affect spacing in lists, code blocks, and callouts as well, so you may want to exclude those.
Adding a part to take care of Reading view (the top section), you could try something like this to see if it works:
.markdown-preview-view br {
content: '';
display: block;
margin-block: 5px;
}
.markdown-source-view .cm-line:not(.HyperMD-list-line, .HyperMD-codeblock, .HyperMD-callout) {
padding-block: 5px;
}
Live Preview before:
Live Preview after:
buigui
January 20, 2024, 9:29am
3
Great, it works and helped me a lot.
Thank you so much
1 Like
system
Closed
January 27, 2024, 3:16pm
5
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.