Mike Hejmej
Mike Hejmej

Reputation: 43

Where is the extra margin/padding coming from?

I have an extremely simple layout right now:

<div class="spacer">
<h1>Finalizing Your Account </h1>
</div>

<div class="greycont60 greycont">
<div class="minispacer"><h5>Almost done! Just a few things left...</h5></div>
</div>
<div class="greycont40 greycont"></div>
<div style="clear:both;"></div>

Here is the CSS:

.minispacer {
background: #d9d9d9;
height:30px;
width: 300px;
padding-left:10px;
}

.greycont60 {
width: 56%;
float: left;
}

.greycont40 {
width: 36%;
float: right;
}

.spacer {
height:56px;
background:url(../images/bg2.png) repeat;
padding:0 10px;
margin-top:20px;
margin-bottom:10px;
}

.spacer h1 {
font-size:22px;
padding-top:4px;
color:#727272;
}

.greycont {
background-color:#e8e8e8;
padding:15px;
margin-bottom:10px;
}

Now here is how it turns out:

enter image description here

Why is their so much space about the MiniSpacer bar? I tried to add 1px of top padding and suddenly the bar was doing some crazy things...

Upvotes: 0

Views: 300

Answers (1)

AdityaSaxena
AdityaSaxena

Reputation: 2157

Try adding margin:0px; to your h5 tag. Heading tags get default top and bottom margins.

Thanks, Aditya

Upvotes: 1

Related Questions