Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unwanted newline after header in Markdown

I am adding a ## (h2) header in Markdown and I want the following line to be directly under the header but there is an additional blank line between the Header and Line under.

Example (how it looks now):

Header

line after with a blank space under

I dont want that line after the Header line....

like image 672
Taylor Rulien Avatar asked Jan 23 '26 09:01

Taylor Rulien


1 Answers

There is no "blank line". It's simply that the header has a bottom margin which makes it appear that a blank line exists. If you want no extra whitespace between the header and the line following it, just define some CSS which removes any margin:

h2 {
    margin: 0;
}

Note that the above rule applies only to <h2> headers. For all headers you can do:

h1, h2, h3, h4, h5, h6 {
    margin: 0;
}
like image 172
Waylan Avatar answered Jan 27 '26 01:01

Waylan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!