Space between Headings and Text in reading mode is absurd

I’ve been trying for two days to reduce the spacing between the headings and the text below them. I’ve tried several snippets and tips from this forum, but nothing works. I’ve searched for plugins, searched through all the style settings.

I don’t understand why Obsidian still has this absurdly large gap between headings and text in reading mode after all these years. Not only is it misleading to use different layouts in reading mode and editing mode, it also looks ugly and is distracting when reading.

Why do we users have to ask every year for such a simple feature that allows us to determine the spacing ourselves in the settings? Why do I, as a user, always have to spend hours searching the internet for codes when I’m not a programmer? I’m happy to pay you for such features, but please change what you’ve been asked for for years. Thank you!

It is not really a choice made by Obsidian, but the default for Markdown rendering. Regardless, if you want to reduce the space here is a css solution which worked for me with the default Obsidian theme. The !important are not necessary, but put them in just in case you have a theme which changes these values. I’ve put the values to 0 to completely remove the extra space, change them to fit what you need.

h1, h2, h3, h4, h5, h6 {
    /* Changes the spacing after the heading*/
    margin-block-end: 0em !important;
}

.el-h1 + .el-p > p,
.el-h2 + .el-p > p,
.el-h3 + .el-p > p,
.el-h4 + .el-p > p,
.el-h5 + .el-p > p,
.el-h6 + .el-p > p {
    /* Changes the spacing before the text if it comes after a heading*/
    margin-block-start: 0em !important;
}
1 Like

Markdown doesn’t specify default styling, just which HTML element things become.

1 Like