Reputation:
How can I remove spaces between paragraphs in HTML?
<p class="first">This is a small demo</p>
<p class="second">This is second demo</p>
Upvotes: 12
Views: 77833
Reputation: 1122
There are a range of "m-x" classes you can add to paragraph elements where x (0+) represent integers driving increasing space between paragraphs:
For example, this will have no space between the paragraphs:
<p class="m-0">hello world</p>
<p class="m-0">hello world</p>
For example, this will have a bit more:
<p class="m-1">hello world</p>
<p class="m-1">hello world</p>
For example, this will have yet more:
<p class="m-2">hello world</p>
<p class="m-2">hello world</p>
And so on...
Upvotes: 0
Reputation: 4704
In case you are using bootstrap this is the solution: the class m-0
<p class="m-0">text</p>
Upvotes: 1
Reputation: 123
You should use p {margin: 0 auto;}
In case you want to add indentation (recommended if you remove spaces between paragraphs) a good technique is:
p + p {text-indent: 1.25em;}
Upvotes: 1
Reputation: 17
Try to use line-height: 100%;
or other percentage you think it feets well on your HTML.
Upvotes: 1
Reputation: 51
You can set the default margin to zero with CSS:
p {
margin: 0px;
}
Upvotes: 1
Reputation: 6554
You can use margin: 0;
to remove the spaces.
p { margin: 0; }
If this still don't work, try making it !important
p { margin: 0 !important; }
Check this http://jsfiddle.net/zg7fP/1/
Upvotes: 23
Reputation: 1477
Try setting margin-bottom: 0
on the top paragraph and margin-top: 0
to the bottom paragraph
or you can use a div instead of the paragraph
Upvotes: 4