CSS to put a Divider <hr> after a ##H2

Hello everyone, any help on how do I create a CSS snippet to auto put a divider after H2 heading?

Like this one:

I don’t think you can add an <hr> that way. But you can add a bottom border.

h2 {border-bottom: 1px solid lightgray;}

You may need to use different selectors for editing view; I don’t do enough CSS in Obsidian to know what they are.

Here is info about working with borders: border - CSS: Cascading Style Sheets | MDN

And how to make CSS snippets, if you need that: CSS snippets - Obsidian Help


I kind of did that and it worked! Ty.

.HyperMD-header-2 {
	border-bottom: 1px solid lightgray;

h2, .markdown-rendered h2 {
	border-bottom: 1px solid lightgray;
1 Like

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