CSS HTML

How to reduce the spacing between paragraphs in HTML

March 4, 2022

How to reduce the spacing between paragraphs in HTML

In this article you will learn how to reduce the spacing between paragraphs in HTML, which is initially large and can mess up the layout.

reduce the spacing between paragraphs in HTML thumb

What’s up programmer, all right? Let’s learn something new!

By default the paragraphs in HTML are far from each other, and even too much

So it is necessary to regulate this measurement via the margin property using CSS

Because this property is started as margin-bottom and 10px

Making them 10px farther apart than their heights, representing a good blank space

Let’s see a practical example of how to eliminate this margin:

<p>The paragraphs</p>
<p>Are too separated</p>

And now the CSS to solve the problem:

p {
 margin: 0;
}

By putting this rule in your style file, the paragraphs will be together, check it out:

And in this way, we were able to solve our problem, which were the paragraphs too spaced

Due to the margin that starts with 10px at the bottom of each p tag element

Conclusion

In this article we learned how to reduce the spacing between paragraphs in HTML, the <p> tag of HTML

We just remove all the values from the margin, which is already set by default in HTML

With this, the spacing of the paragraphs was reduced to just the height of the line that represents them.

Want to learn more about HTML and CSS? Click here!

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x