Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is there so much space between <h3> and <p>

Tags:

html

css

I don't get it. Why is there so much space between "title" and "text"? Please take a look at this code:

 <h3 style="background:#000">Title</h3>
        <p class="d" style="background:#000">
       Text Text Text Text Text Text Text Text Text Text Text 
        </p>

There are absolutely no other styles applied to those two elements, but still, there are so much unused space. Anyone have an idea here?

enter image description here

like image 502
rootpanthera Avatar asked Dec 17 '13 12:12

rootpanthera


People also ask

How do I reduce the space between H tags?

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 you get rid of spaces between headers?

Set your cursor to the location of the paragraph spacing. Click on the Line and Paragraph Spacing icon in the Home Ribbon. Select "Remove Extra Space" to remove the extra space.

How do I reduce the space between paragraph and header?

Go to Layout, and under Spacing, click the up or down arrows to adjust the distance before or after the paragraph. You can also type a number directly.

How do I get rid of the white space between header and body in CSS?

Just set margin:0 in your h1 tag. Save this answer.


1 Answers

The caption tags (<h1>, <h2>, ...) have a default padding and margin applied to them. The same is for the paragraph <p>

If you want to remove those default spacing add the following style to the captions and paragraphs inside your css or element:

padding: 0; margin: 0;
like image 193
RononDex Avatar answered Oct 04 '22 04:10

RononDex