ymd_ ymd_ - 4 months ago 22
CSS Question

Why <p> have two line breaks instead one?

I donĀ“t understand why

tag in HTML has two line breaks instead one, can someone tell me why its like that and if its possible to fix it to one with CSS.

Two line breaks:

<p>Hello World</p>my name is Yoel.

Compares with
one line break:

Hello World
<br>my name is Yoel.


What you're seeing isn't actually an extra line-break, but a margin. By default p tags come with a small margin to help visually define them.

If you want to get rid of that you can add the following to your CSS:

p {
    margin: 0;