Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Decrease the space between header and paragraph vertically in html

Tags:

html

css

I want to decrease the vertical spacing between header and paragraph.

<td style="width:427px;">
  <h2 style="color:#156CA4">Quotation</h2>
  <p style="color:#00A651">abc Technologies Pvt Ltd</p>
</td>
like image 503
krishna mohan Avatar asked Jan 20 '16 11:01

krishna mohan


People also ask

How do I remove space between paragraph and header in HTML?

Shift + Enter will force a break within a paragraph tag to give the appearance of single line spacing. Under a heading tag it will create a new paragraph tag that is subject to the css spacing rules.

How do I reduce the space between paragraphs in HTML?

It turns out that's pretty simple: just use the line-height CSS property and then apply it. I have an example below. Then, you can apply that CSS class to your HTML. Now, the space between the lines changes.


1 Answers

Try adjusting the line height property using CSS. I would recommend giving it an id though if you only want it to affect this p tag in particular

p {
    line-height: 0px;
}

There is also the possibility of negative margins (which isn't considered best practice, but will work in your case):

p {
    margin-top:-5px;
}
like image 135
Smithy Avatar answered Oct 12 '22 13:10

Smithy