Changing line spacing just for certain tagged blocks

I insert a lot of comments into my outlines, tagging them #comment or #note. I want these blocks and their children to stand out very clearly from the outline proper. To that end I’ve used custom.css to change their background colour and reduce their font size.

div[data-refs-self*="comment"] {font-size: 0.7rem; background: whitesmoke;}.content

While this succeeds in making my comment blocks visually distinct, the lower font size combined with Logseq’s standard line spacing makes them look plain ugly.

Unfortunately, for the life of me I can’t figure out how to reduce the line spacing for just those blocks. Lowering the line-height works just fine on the text WITHIN a given child block. But the DIV elements that enclose the text remain fixed in height, so that the spacing BETWEEN child blocks is unaffected. Setting padding, margins and/or min-height for those DIVs to zero achieves nothing. Giving them an absolute-value height works just fine for child blocks that are no more than one line long; but then second or subsequent lines in a given child block extend past the coloured background.

Any thoughts on how to solve this problem?

[data-refs-self*="comment"] * {
    line-height: 1;

This changes the height of the block without the problem. If this doesn’t work for you, something else is interfering, either the theme you’re using or something in your custom.css.

Thanks Piotr for the suggestion. I tried it out, but unfortunately did not get the same result as you.

There is nothing else in my custom.css file except the lines setting the background and font size of my #comment blocks. Just in case, I commented out everything else and just left your line; still no joy.

I am using the Dev theme. But when I switched back to the Default Light Theme, the problem persisted.

The fact that the line-height instruction worked for you led me to try out the same graph on my iPad. There the line-height instruction has the desired effect. So this problem is only occurring in my Mac Intel desktop environment.

I’m due to switch over next week to a Mac with an Apple M2 chip. With luck this problem will go away in the Apple Silicon version of Logseq.

One more thing you can try is to disable all of the plugins, if you’re using any. After that, press “Shift + Cmd + R” (anywhere within Logseq) and see if that helps.

Thanks again. I am indeed using a few plugins. I disabled them all and then refreshed Logseq. The line-spacing problem persisted. So there must be a small CSS-related bug in the Mac Intel version of Logseq.