Muhammad Arif
Muhammad Arif

Reputation: 1022

How to decrease space between headings?

I make a div and inside I make headings but when shown the headings are outside the div. How do I decrease the heading margins?

Here is my code:

<div id="left" style="width:300px; height:100px; float:left; margin:5px 40px 0;">
<h5 id="companyname">{{companyname}}</h5>
<h5 id="companyaddress">{{companyaddress}},{{companycity}},</h5>
<h5 id="companycountry">{{companycountry}}</h5>
</div>

And here is the css:

#companyname{
    text-align:left;
    font-size:13px;
}

#companyaddress{
    text-align:left;
    width:68%;
    font-size:13px;
}

#companycountry{
    text-align:left;
    font-size:13px;
}

Upvotes: 6

Views: 46167

Answers (4)

Dinesh Kanivu
Dinesh Kanivu

Reputation: 2587

You have two Option.

  1. Increasing the Height of the div

  2. give css for h5 like this because by default h5 element takes some margin

    h5{ margin:0px}

Upvotes: 0

Falguni Panchal
Falguni Panchal

Reputation: 8981

Like this

demo

css

h5{
    margin:0;
    padding:0;
}

Upvotes: 12

Abhitalks
Abhitalks

Reputation: 28387

Question:

how to decrease heading margins?

Answer:

h5 { margin: 0px; }

Upvotes: 0

try adding

h5
{
line-height:10px;
}

i have used 10px you can use values accordingly to your need

Fiddle Demo

Setting up the margins and padding accordingly is also a good option

h5 {
    margin:0px;
    padding:0px;
}

Upvotes: 1

Related Questions