How can I reduce the vertical space between paragraph and unordered list correctly?

Hi, I’m new to css and want to reduce the space between <p> and <ul>.

I tried to use this custom snippet

p + ul {
    margin-top: -10px;
}

from this post on stackoverflow.

But this does not work in obsidian.

I cannot just reduce the top margin or change line height of <ul>, since it will affect nested list appearance.

I also tried reducing bottom margin of paragraph, but it will make table after paragraph too close to the paragraph, so still not OK.

Is there a way to modify the vertical space between paragraph and list only?

1 Like

Try this:

ul {
  margin-block-start: 0em;
}

Thank you! I set it to -0.7em and now it works exactly as I expected!