ymd_ ymd_ - 1 year ago 71
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.

Answer Source

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;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download